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.

React 18 compatibility

See original GitHub issue

Add react 18 dependencies:

"react": "^18.0.0",
"react-dom": "^18.0.0",

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
ChrisSamo632commented, Apr 13, 2022

For me, the problem was that this library pulls in an older version of react and react-dom (17.0.2) compared with that use by my project (18.0.0)

https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react suggests that maybe react/react-dom should be specified as peerDependencies rather than dependencies within this library (I don’t know whether that’s correct/something to change here)?

As my project is being built with yarn, I was able to set resolutions in my package.json to include

    "resolutions": {
        "react": "^18.0.0",
        "react-dom": "^18.0.0"
    }

This appears to have allowed the <Carousel /> to work again for me without any further changes.

1reaction
Bodriecommented, Apr 20, 2022

should be this if you use npm instead of yarn. but didn’t test it

  "overrides": {
    "react-material-ui-carousel": {
      "react": "^18.0.0",
      "react-dom": "^18.0.0"
    }
  }

works only with npm@^8.3 https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides

Yes, this works!
Just don’t forget to delete the package-lock.json and then run npm install

Cheers to @ximex 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

React v18.0 – React Blog
In this post, we'll give an overview of what's new in React 18, ... may take some time for libraries to upgrade to...
Read more >
Partial list of React 18 compatible library releases #113 - GitHub
Let's use this discussion to track libraries that are known to be compatible with React 18, or have published a React 18-compatible prerelease....
Read more >
React 18 & React Native
tl;dr: The first version of React Native compatible with React 18 is 0.69.0. In order to use the new features in React 18...
Read more >
What's Coming In React 18? - How-To Geek
To take advantage of all the features, you'll need to upgrade your project and may encounter some breaking changes. React 18 is still ......
Read more >
Everything You Should Know About React 18 | Syncfusion Blogs
Syncfusion React JS UI components will always be compatible with the latest React versions. We will include support for React 18 after it ......
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