You ran npx create-react-app@latest
to get things started. Now you want to take it down a notch, to say version @17.
Do these:
- Remove node_module
- Remove package-lock.json
- In package.json > change version for react & react-dom to "^17.2.0" or your choice
- Update index.js as shown:
import React from 'react';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { render } from 'react-dom';
const root = document.getElementById('root');
render(
<React.StrictMode>
<App />
</React.StrictMode>,
root
);
reportWebVitals();
@17 doesn't use ReactDOM
Get root element directly with DOM selector
Pass root as 2nd arg to render()
Top comments (0)