Rule: `no-direct-event-calls-in-components`
sergeysova opened this issue · 0 comments
sergeysova commented
It can be useful for SSR or SPA with testing approaches.
Should ban direct calls of effector events inside React/Solid components.
Fail:
// no-direct-event-calls-in-components: 'error'
import { somethingHappened } from './model'; // Event
function Example() {
// Should suggest to wrap it with `useEvent` from "effector-react/scope"
return <div onClick={() => somethingHappened()} />
}
Okay:
// no-direct-event-calls-in-components: 'error'
import { useEvent } from 'effector-react/scope';
import { somethingHappened } from './model'; // Event
function Example() {
const handleClick = useUnit(somethingHappened);
return <div onClick={() => handleClick()} />
}