- Exhaustive Deps: Always provide all dependencies to
useEffect,useMemo, anduseCallback. If a function is a dependency, ensure it is wrapped inuseCallbackor defined inside the hook. - Sync State in Effects: NEVER call
setStatesynchronously insideuseEffect. This triggers unnecessary cascading renders. UseuseMemofor derived state or initialize state directly if possible. - Fast Refresh Compatibility: Files exporting React components (especially Contexts) must NOT export other constants or helper functions. Move helpers to separate utility files.
- Library Safety: Be aware of incompatible libraries with the React Compiler (e.g.,
useReactTable). Do not wrap their return values inuseMemoif the library manages its own internal memoization or returns unstable function references.