react-hooks-js/incompatible-library
Validates against usage of libraries which are incompatible with memoization (manual or automatic)
- 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/incompatible-library
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
Fires on a hardcoded allowlist (maintained in facebook/react's DefaultModuleTypeProvider.ts) of APIs that use interior mutability and break memoization — currently react-hook-form's watch(), TanStack Table's useReactTable, and others. False positive: you've already opted that file or component out of compilation via the 'use no memo' directive, or the API has shipped a memo-safe replacement since the list was published.
Fix prompt
Use this once validation confirms the diagnostic is real.
Swap for the library's memo-safe alternative when one exists — useWatch + control instead of watch for react-hook-form, the newer immutable-state hooks for TanStack Table. For libraries without a fix (MobX observer, etc.), add 'use no memo' as the first statement of the affected component or file so the Compiler skips it cleanly. File an issue upstream so the allowlist can grow. See https://react.dev/reference/eslint-plugin-react-hooks/lints/incompatible-library