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.

Improve message "dispatcher.useState is not a function" when mixing react@next with react-dom@16.5.2

See original GitHub issue

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 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:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
sophiebitscommented, Oct 31, 2018

@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.

3reactions
geoffdavis92commented, Oct 31, 2018

@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.

Read more comments on GitHub >

github_iconTop 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 >

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