Invalid hook call. Hooks can only be called inside of the body of a function component
What causes it and how to fix it:
- A component from a linked package throws "Invalid hook call" in Jest — the test loaded a second copy of ReactJest resolves a file:/junction package by its real path, so the package's require('react') finds a second copy; map react and react-dom to the app's copy (the SPFx build is unaffected — React is a platform component)Cause and fix →