react-hooks-js/preserve-manual-memoization
Validates that existing manual memoized is preserved by the compiler. React Compiler will only compile components and hooks if its inference [matches or exceeds the existing manual memoization](https://react.dev/learn/react-compiler/introduction#what-should-i-do-about-usememo-usecallback-and-reactmemo)
- Category: React Compiler
- Severity: error
- Source:
eslint-plugin-react-hooks - Framework: global
- Enabled when: eslint-plugin-react-hooks v6+ installed AND React Compiler detected in project
- Documentation: https://react.dev/reference/eslint-plugin-react-hooks/lints/preserve-manual-memoization
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
Fires when an existing useMemo, useCallback, or React.memo has missing dependencies — the Compiler refuses to further optimize the component because it cannot prove your hand-written memo is correct. False positive: the missing dep is intentionally stable across the component's lifetime (useRef return value, useState/useReducer setter or dispatch, useEffectEvent function) — those genuinely do not need to be listed.
Fix prompt
Use this once validation confirms the diagnostic is real.
Add the missing dependency to the array and the Compiler will take over (and may safely remove the manual memo). For callbacks that must read the latest value of a dep without re-creating, wrap them with useEffectEvent. Often the cleanest fix is deleting the useMemo/useCallback entirely and letting React Compiler memoize automatically — it is allowed to memoize at least as aggressively as you would. See https://react.dev/reference/eslint-plugin-react-hooks/lints/preserve-manual-memoization