question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: dispatcher.useState is not a function

See original GitHub issue

If you hit this error, you’re trying to use hooks after upgrading react to 16.7, but you haven’t upgraded react-dom to the same version!

The experience could be improved by checking for dispatcher.getState here https://github.com/facebook/react/blob/504576306461a5ff339dc99691842f0f35a8bf4c/packages/react/src/ReactHooks.js#L17, and throwing an error that explains your -dom package is out of date.

Closing because there is no real bug here, just hope somebody finds this useful

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:35
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
artivillacommented, Dec 27, 2018

Had a similar issue but I had to specify exact version 16.7.0-alpha.2 as a dep rather than the default ^16.7.0-alpha.2 that would resolve to 16.7.0 in my lockfile.

3reactions
mp3commented, Nov 6, 2018

I got this error when using Jest. and i update react-test-renderer then solved.

yarn add -D react-test-renderer@next

"react": "^16.7.0-alpha.0",
"react-dom": "^16.7.0-alpha.0",
"react-test-renderer": "^16.7.0-alpha.0",
Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError dispatcher.useState is not a function when using ...
There could be many reasons, and most are due to version incompatibilites or using a ^ in package.json : 1. Ensure react and...
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 >
Invalid Hook Call Warning - React
There are three common reasons you might be seeing it: You might have mismatching versions of React and React DOM. You might be...
Read more >
React 16.7 Hooks: 'React.Usestate' Is Not A Function - ADocLib
TypeError dispatcher.useState is not a function when using React Hooks. Solution: There could be many reasons and most are due to version incompatibilites....
Read more >
React — Uncaught TypeError: destroy is not a function - Medium
To fix your app, change the useEffect arrow function to add curly braces and remove the Implicit Return, as shown: Now, the arrow...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found