If you're react v18, and you want to go down to the previous non-change breaking version, here's what you can do:
In your package.json replace:
"react": "^18.0.0"
"react-dom": "^18.0.0"
With
"react": "^17.0.2"
"react-dom": "^17.0.2"
Then go to your entry file index.js At the top, replace:
import ReactDOM from 'react-dom/client'
With
import ReactDOM from 'react-dom';
In your index.js file, replace:
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
With
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
- Delete your node_modules and run yarn install or npm i --force
- After installation, run yarn start or npm start
--------------------------------------OR------------------------
If you want through npx command
npx create-react-app[version] my-app
npx [email protected] my-app