DEV Community

Cover image for Downgrade create-react-app@latest to @17
Keme Kenneth
Keme Kenneth

Posted on

Downgrade create-react-app@latest to @17

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:

  1. Remove node_module
  2. Remove package-lock.json
  3. In package.json > change version for react & react-dom to "^17.2.0" or your choice
  4. 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();
Enter fullscreen mode Exit fullscreen mode

@17 doesn't use ReactDOM
Get root element directly with DOM selector
Pass root as 2nd arg to render()

Top comments (0)