How to downgrade React version 17 to 16

How to downgrade React version 17 to 16

In the previous article, we learned about how to downgrade React 16 to 15. However, React doesn’t just have those two sessions. Currently, the manufacturer has released more upgraded versions for React. In case you have downloaded and used React version 17 but don’t want to continue using it,  Don’t worry! This article will help you to show How to Downgrade React version 17 to 16. Let’s scroll down and get started on encountering the key right now!

What is React.js?

React.js is a Javascript library for building user interfaces, originally developed from Facebook and contributed by the developer community around the world.

React.js can be used to write the background for single-page or mobile applications, making the page fetch and process data more optimized than other methods.

React.js is suitable for large, scalable applications in the future.

Why downgrade React 17 to 16?

Basically, manufacturers will upgrade versions to be able to fix the bugs it has or add other features for users. However, there are also error situations caused by the upgraded version. In case users find it more convenient and easier to use the old version, they will have a desire to downgrade back to the previous version in use.

How to Downgrade React version 17 to 16

Here are some methods you can use to downgrade React version 17 to 16.

Method 1: Remove version 17, install version 16

The simplest and most direct way is to delete the version of React 17 that is installed on your device. Then download version 16 to reinstall.

To do this, first you need to run this command line:

npm uninstall react

After the command line is run, React 17 version will be removed from the machine, you continue to run the command below to install version 16:

npm install [email protected]

Finally to check what is the latest version you have, use this command:

npm view react version

Method 2: Modify package dependencies

In addition to the above method, you can also choose the manual method of adjusting directly on your machine. After accessing the package.json file, you will find and edit the react, react-dom tags in the package dependencies to:

"dependencies": {
     "react": "^16.14.0",
     "react-dom": "^16.14.0",
     ...
   },

Once changed, you will start running the command npm install to install the React 16 version on your device.

Method 3: 

If the above two methods don’t work for you, try running this command line:

Now your React version has been downgraded to 16

Conclusion

Thus, we have solved for you the questions “How to Downgrade React version 17 to 16”.  We hope our method helps you a lot in finding your most suitable answer. If you have any comments, please contact us immediately for answers. Thanks for reading!

Maybe you are interested:

Leave a Reply

Your email address will not be published. Required fields are marked *