React 19: Invalid hook call — multiple copies of React in the same app
Unhandled Runtime Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
Immediate Remediation
bash
npm ls react react-dom && npm dedupe && npm ls react react-dom
Root Cause Analysis
Multiple copies of React are installed (e.g. a dependency bundles its own React or a mismatched react-dom version), causing hooks to be registered on a different React instance than the one used by the renderer, so hook calls fail with the invalid hook call error.
Verification & Guardrails
- Run `npm ls react` to identify duplicate React versions in the dependency tree.
- Use `npm dedupe` or `overrides` in package.json to force a single React version.
- If using a monorepo, ensure all packages resolve to the same hoisted React installation.
Have a custom or uncategorized crash?
Run your trace through our in-memory client privacy sandbox for instant SRE remediation.