dillon1000/react
Commit
Browse files [eslint] Do not allow useEffectEvent fns to be called in arbitrary closures (#33544)
Summary: useEffectEvent is meant to be used specifically in combination with useEffect, and using the feature in arbitrary closures can lead to surprising reactivity semantics. In order to minimize risk in the experimental rollout, we are going to restrict its usage to being called directly inside an effect or another useEffectEvent, effectively enforcing the function coloring statically. Without an effect system this is the best we can do.
Changed paths2 files
First-parent comparisonpackages/eslint-plugin-react-hooks/__tests__/ESLintRulesOfHooks-test.js ModifiedM packages/eslint-plugin-react-hooks/src/rules/RulesOfHooks.ts ModifiedPatch
Files changed
Rendering syntax-highlighted changes…