Hello React developers, Just After React 18 is Launched There are many users facing many errors like ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API And If You don’t want to use React 17 as of now then? In This article, we are going to learn about How to downgrade React version 18 to 17? let’s start this article.
How to downgrade React version 18 to 17?
- How to downgrade React version 18 to 17?
To downgrade React version 18 to 17 First Of all, Open Your package.json file Search For react and react-dom under dependencies, and change both package versions to 17.0.2. Just Like given below: “react”: “^17.0.2”, “react-dom”: “^17.0.2”, Now, run npm install. And now Your React Version is changed to React 17. Thank You.
- downgrade React version 18 to 17
To downgrade React version 18 to 17 If You Don’t want to use React 18 Then Just downgrade to react 17 Just run this command in your terminal: npm install –save react@17.0.2 react-dom@17.0.2 Now, your error must be gone and your problem is solved. Thank You.
Method 1: Changing package.json
First Of all, Open Your package.json file Search For react and react-dom under dependencies, and change both package versions to 17.0.2. Just Like given below.
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2",
...
},
Now, run npm install.
npm install
And now Your React Version is changed to React 17. Thank You.
Method 2: Using Commandline
If You Don’t want to use React 18 Then Just downgrade to react 17 Just run this command in your terminal.
npm install --save react@17.0.2 react-dom@17.0.2
Now, your error must be gone and your problem is solved. Thank You.
Method 3: Run This Command
Just uninstall the react 18 and install the react 17
npm uninstall react
Then install React 17 Just run this command
npm install react@17.0.0
Conclusion
It’s all About this article. Hope this method worked for you. Comment below Your thoughts and your queries. Also, Comment below which method worked for you?
Also, Read
Thanks very much….
It’s my Pleasure to Help You William. Thank You For Your Valuable words.
Thanks a lot, I can now continue my learning!
Thank you for your great support