You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tests using hooks fail because umi and umi-test import their own versions of react.
When running tests the following error will be thrown:
Invariant Violation: 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://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
As you'll see in the code examples the hooks are implemented just like React suggests so issue 2 is not the culprit.
After running npm list react and getting the following output I believe it might come down to issue 1 or 3:
What happens?
Tests using hooks fail because umi and umi-test import their own versions of react.
When running tests the following error will be thrown:
As you'll see in the code examples the hooks are implemented just like React suggests so issue 2 is not the culprit.
After running
npm list react
and getting the following output I believe it might come down to issue 1 or 3:As you can see, react is being included multiple times, with a different version for some of them.
Mini Showcase Repository(REQUIRED)
Repo:
https://github.com/reneolivo/umi-issue
Featured code
How To Reproduce
Steps to reproduce the behavior:
npm run test
Expected behavior
npm run test
Context
The text was updated successfully, but these errors were encountered: