I'm trying React upgrade from 16 to 17. What I should take care of? I have a lot of packages installed. how to handle versions of existing packages, eslint, redux, and other things?
React upgrade from 16 to 17
Asked Answered
Please visit help center, take tour to see what and How to Ask. Then read the release notes –
Fugger
reactjs.org/blog/2020/10/20/react-v17.html –
Vinita
Update: React Scripts, react, react-dom.
npm install [email protected] [email protected] [email protected]
Remove node_modules, package-lock.
rm -rf node_modules package-lock.json
Reinstall and re-build:
npm install
npm run build
Other libraries:
You may need to upgrade other libraries too.
If you are using Typescript:
npm install -D @types/[email protected] @types/[email protected]
If you are using React Testing Library, you would want to be under 12.1.5, which is the latest version that supports React < 18.00
npm install @testing-library/react@"<=12.1.5"
I hope that helps.
You are welcome! If it fixed your problem, would you mind marking it as the accepted answer? Thanks. –
Dumbbell
update: react and react-dom
npm install [email protected] [email protected]
to check other dependencies latest version run
npm install -g npm-check-updates
then:
ncu -u
it will list all dependencies with updated version
remove node_module
and package-lock.json
run npm install
to update listed dependencies
© 2022 - 2024 — McMap. All rights reserved.