How do I upgrade React from 0.13 to 15.0.1?

12,380

Solution 1

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.

Solution 2

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.

Share:
12,380
GeekInTraining
Author by

GeekInTraining

Updated on June 04, 2022

Comments

  • GeekInTraining
    GeekInTraining almost 2 years

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