-
Notifications
You must be signed in to change notification settings - Fork 46.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve message "dispatcher.useState is not a function" when mixing react@next with react-dom@16.5.2 #14039
Comments
useState
@geoffdavis92 You need to update react-dom to the same version. We can likely have a better error for this though. Leaving this issue open to track that. |
you can |
@sophiebits Thank you, that was the issue. For some reason I thought I tried both packages at This is ready to be closed IMO. |
Broadly, this is about warning when we have mismatched versions of react and react-dom installed, yes? This particular error happens right now because we have peerDependencies set with (we could verify versions in runtime too, but that seems like overkill) I'll send out a PR closer to hooks launch to fix this. |
discussed with dan a bit more, the peer dependency wouldn't fix it, since this actually lives on react which doesn't have a peer dep, sigh. I'll send a PR with a better error message. |
the latest version (16.8.0-alpha.0) of react doesn't throw this error anymore (though it does throw an invariant |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
Do you want to request a feature or report a bug?
Report a bug
What is the current behavior?
Getting
TypeError: dispatcher.useState is not a function
when trying to calluseState
; this is happening in a create-react-app, as well as in the CodeSandbox example below.Example:
https://codesandbox.io/s/7kp55lwwpj
What is the expected behavior?
useState
hook function should execute without error as defined in the API documentationWhich versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React: v16.7.0-alpha.0
React-DOM: 16.5.2 (CSB), 16.7.0-alpha.0 (local)
React-Scripts: 2.0.3 (CSB), 2.1.0 (local)
The text was updated successfully, but these errors were encountered: