Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I upgrade React from 0.13 to 15.0.1?

Please tell me step by step process of upgrading React from version .13 to 15.0.1 .

like image 991
GeekInTraining Avatar asked Oct 14 '16 06:10

GeekInTraining


People also ask

How do I upgrade a React to a specific version?

To update your React version, install the latest versions of the react and react-dom packages by running npm install react@latest react-dom@latest . If you use create-react-app , also update the version of react-scripts . Copied! The command will update the versions of the react-related packages.


2 Answers

Update react version in package.json
Delete node_modules folder
Run npm install

install process will fail if there is any version mismatch among other dependencies in package file, console will show the expected compatible version number. Update those and run npm install again.

Once install is complete, then build your application and test. If any error appear due to deprecated code, then you would have to fix those as well.
One of the deprecated syntax from ver 13, is usage of react.render
There you will have to import react-dom and use that to call render. There can be many other potential issues which you may encounter. So test you app properly.

React entries in package.json that I have:

"react": "15.0.1",
"react-addons-perf": "15.0.1",
"react-addons-test-utils": "15.0.1",
"react-addons-update": "15.0.1",
"react-dom": "15.0.1"

All the best!
P.S. This is the process I follow, there may be some other way to do it.

like image 86
M.Sharma Avatar answered Sep 20 '22 23:09

M.Sharma


By experience I can say that each version of react-native has breaking changes, for example from version 17 on, you need to remove @override on

 public List<Class<? extends JavaScriptModule>> createJSModules()

So my advice is update progressively along with all you project dependencies.

like image 28
Ale Sanabria Avatar answered Sep 20 '22 23:09

Ale Sanabria