Improve message "dispatcher.useState is not a function" when mixing react@next with react-dom@16.5.2
See original GitHub issueDo 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 call useState
; 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 documentation
Which 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)
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
TypeError dispatcher.useState is not a function when using ...
as I want to try out the new React hooks proposal by installing react@16.8.1 in my package.json , but I'm getting an error:...
Read more >JavaScript : TypeError dispatcher.useState is not a ... - YouTube
JavaScript : TypeError dispatcher. useState is not a function when using React Hooks [ Gift : Animated Search Engine ...
Read more >React useReducer Hook ultimate guide
The useReducer Hook is used to store and update states, just like the useState Hook. It accepts a reducer function as its first...
Read more >TypeError dispatcher.useState is not a function when using ...
TypeError dispatcher.useState is not a function when using React Hooks. Reactjs. I have this component: import React, { useState, useEffect } ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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.
@sophiebits Thank you, that was the issue. For some reason I thought I tried both packages at
next
but I suppose I did not.This is ready to be closed IMO.