How to downgrade React version 17 to 16?

Viewed 51831

How can I downgrade my React version from 17 to 16 as many of the React packages are not supported by React 17?

3 Answers

Assuming you're using npm/yarn or another node package manager, dependency versions are listed in package.json.

Search for the react and react-dom packages under dependencies (or devDependencies) and replace their versions with 16.13.0. Then run npm install or yarn or whatever package manager you're using. This should be enough to downgrade to React 16.

If you have packages not compatible with React 16, you might have to downgrade them, too.

Because I needed redux-devtools as a package on an old project, I had to downgrade from React v17 to React v16. That's what i have done:

npm uninstall react-redux npm uninstall redux

npm install --save react@16.14.0 react-dom@16.14.0

npm install redux npm install react-redux

npm install --save-dev redux-devtools
Related