Hello Guys, How are you all? Hope You are very well and safe. Sometimes we need to create our React App With Older React Version using create-react-app. So we will Learn How to use create-react-app with an older React version? So let’s start this article without wasting your time.
How to use create-react-app with an older React version?
- How to use create-react-app with an older React version?
As I think create-react-app command does Not give any facility to create your react project with a custom react version. create-react-app will always install latest react packages. But We Can Downgrade Our React Version manually. First Of all, Open Your package.json file Search For react and react-dom under dependencies, and change both package versions to whatever you want to use I want to use 17.0.2. Just Like given below: “react”: “^17.0.2”, “react-dom”: “^17.0.2”, Then delete your node_module folder: rm -rf node_modules Now, run npm install: npm install And now Your Projects React Version is changed to React 17. Thank You.
- create-react-app with an older React version
As I think create-react-app command does Not give any facility to create your react project with a custom react version. create-react-app will always install latest react packages. But We Can Downgrade Our React Version manually. First Of all, Open Your package.json file Search For react and react-dom under dependencies, and change both package versions to whatever you want to use I want to use 17.0.2. Just Like given below: “react”: “^17.0.2”, “react-dom”: “^17.0.2”, Then delete your node_module folder: rm -rf node_modules Now, run npm install: npm install And now Your Projects React Version is changed to React 17. Thank You.
Solution 1:
As I think create-react-app command does Not give any facility to create your react project with a custom react version. create-react-app will always install latest react packages. But We Can Downgrade Our React Version manually.
First Of all, Open Your package.json file Search For react and react-dom under dependencies, and change both package versions to whatever you want to use I want to use 17.0.2. Just Like given below.
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2",
...
},
Then delete your node_module folder.
rm -rf node_modules
Now, run npm install.
npm install
And now Your Projects React Version is changed to React 17. Thank You.
Conclusion
It’s all About How to use create-react-app with an older React version?. I hope You understand how to use it. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also, Read
- How to display SVG image in React Component?
- Warning: A component is changing an uncontrolled input of type text to be controlled
- Unexpected reserved word ‘await’
- How to use a switch Case statement inside a React component?
- type is invalid — expected a string (for built-in components) or a class/function