What is the procedure on upgrading React 15.X to React 16.X

Viewed 19268

I upgraded from React 15.X to 16.X, but there are so many methods are no longer used, that result the application can’t work as expected. But the application linked with LOTS of old libraries which relay on 15.X. Is this possible to have both React version in the same application? Thanks.

2 Answers

You'll have to explicitly tell npm to go to the next major version.

npm install --save react@^16.0.0 react-dom@^16.0.0

then run

npm update --save

to get all dependent packages and latest updates for all your packages.

From React v16.0 Blog Post:

... With minor exceptions, if your app runs in 15.6 without any warnings, it should work in 16.

For deprecations listed in packaging below, codemods are provided to automatically transform your deprecated code. See the 15.5.0 blog post for more information, or browse the codemods in the react-codemod project.

Maybe check the react-codemod project out?

Related