dillon1000/react
Commit
Browse files Update RulesOfHooks with useEvent rules (#25285)
This update to the RulesOfHooks rule checks that functions created with `useEvent` can only be invoked in a `useEffect` callback, in another event function, or a closure. They can't be passed down directly as a reference to child components. This PR also updates the ExhaustiveDeps lint rule to treat useEvent's return value as stable, so it can be omitted from dependency lists. Currently this all gated behind an experimental flag. Co-authored-by: Dan Abramov <[email protected]>
Changed paths4 files
First-parent comparisonpackages/eslint-plugin-react-hooks/__tests__/ESLintRuleExhaustiveDeps-test.js ModifiedM packages/eslint-plugin-react-hooks/__tests__/ESLintRulesOfHooks-test.js ModifiedM packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js ModifiedM packages/eslint-plugin-react-hooks/src/RulesOfHooks.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…