DEV Community

Cover image for How to downgrade from react 18 to 17.0.2

How to downgrade from react 18 to 17.0.2

Ifeanyi Chima on April 17, 2022

I might not be the only one who is really scared of change in technology causing a break in my code, but you don't have to fear anymore. with the n...
Collapse
 
rzeczuchy profile image
rzeczuchy

I needed this for a tutorial on MERN stack that had dependency conflicts with React 18. Thanks @ifeanyichima

Collapse
 
ifeanyichima profile image
Ifeanyi Chima

Thank you, please follow me.

Collapse
 
alchey_jay profile image
vijay j

adrian jsm ?

Collapse
 
emfresh2o profile image
Ella Mae Freshwater

was learning to create a project and needed mui v4... needed to downgrade to react 17 to make it work.. thank you so much!

Collapse
 
ifeanyichima profile image
Ifeanyi Chima

Thank you, please follow me.

Collapse
 
alchey_jay profile image
vijay j

what about other dependencies like axios and moment and redux were they affected by the down grade

Collapse
 
rajeshmanne profile image
Rajesh-Manne

Thanks a lot. This solution was helpful.

Collapse
 
ifeanyichima profile image
Ifeanyi Chima

Thank you, please follow me.

Collapse
 
sohail48 profile image
sohail48

Thankyou very much

Collapse
 
ifeanyichima profile image
Ifeanyi Chima

Thank you, please follow me.

Collapse
 
kinggreatmanspirit profile image
King Greatman Spirit

Thank you for being a solution provider

Collapse
 
ifeanyichima profile image
Ifeanyi Chima • Edited

Thank you, please follow me.

Collapse
 
virginiel profile image
VirginieLemaire

Thank you very much

Collapse
 
ifeanyichima profile image
Ifeanyi Chima

Thank you, please follow me.

Collapse
 
rag74 profile image
rag74

thank you very much!< Pretty explained, very simple and helpful

Collapse
 
ifeanyichima profile image
Ifeanyi Chima

Thank you, please follow me.

Collapse
 
eric_zhang_8e76523af5fbde profile image
Eric Zhang

There is one caveat that the dependency of "@testing-library/react": "^13.0.1" is not downgraded. I think to fully support react17, this should be of version 12 not 13. Do you know how to fix this issue?

Collapse
 
jimjacob29 profile image
JIMMY JACOB
Collapse
 
mazharkhan77 profile image
Mazhar™ मजहर મઝહર مظہر 🇮🇳

Yes, I am getting this error too. but it is not affecting my code compilation and code is running smoothly.

Collapse
 
alchey_jay profile image
vijay j

Guys Im getting error while installing other dependencies like axios , redux , redux-thunk , moment and base 64 .

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @testing-library/react@13.4.0
npm ERR! Found: react@17.0.2

npm ERR! node_modules/react
npm ERR! peer react@"17.0.2" from react-dom@17.0.2
npm ERR! node_modules/react-dom

npm ERR! react-dom@"^17.0.2" from the root project
npm ERR! peer react@">= 16" from react-scripts@5.0.1
npm ERR! node_modules/react-scripts
npm ERR! react-scripts@"5.0.1" from the root project
npm ERR! node_modules/@testing-library/react
npm ERR! @testing-library/react@"^13.4.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! node_modules/@testing-library/react
npm ERR! @testing-library/react@"^13.4.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! node_modules/@testing-library/react
npm ERR! @testing-library/react@"^13.4.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! node_modules/@testing-library/react
npm ERR! node_modules/@testing-library/react
npm ERR! @testing-library/react@"^13.4.0" from the root project
npm ERR! @testing-library/react@"^13.4.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR!
npm ERR! For a full report see:

Collapse
 
savecohub profile image
Naz Hussain

Any idea how to downgrade from React 19RC to 18.3?

Collapse
 
gstark10 profile image
Udechukwu Godson • Edited

Cool..buh don't understand number 4,pls where exactly should I paste the index js from my src.@ifeanyichima