React upgrade from 16 to 17
Asked Answered
M

2

5

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?

Massimiliano answered 21/8, 2022 at 8:23 Comment(2)
Please visit help center, take tour to see what and How to Ask. Then read the release notesFugger
reactjs.org/blog/2020/10/20/react-v17.htmlVinita
D
12

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.

Dumbbell answered 21/8, 2022 at 8:49 Comment(1)
You are welcome! If it fixed your problem, would you mind marking it as the accepted answer? Thanks.Dumbbell
R
0

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

Raby answered 26/7 at 3:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.