Skip to content

Instantly share code, notes, and snippets.

@thatisuday
Created April 16, 2022 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thatisuday/3f990e2133ced770369250cd3499368f to your computer and use it in GitHub Desktop.
Save thatisuday/3f990e2133ced770369250cd3499368f to your computer and use it in GitHub Desktop.
Creating root in React v18
// v17 and below
import ReactDOM from 'react-dom';
const container = document.getElementById('app');
ReactDOM.render(<App />, container);
// v18
import { createRoot } from 'react-dom/client';
const container = document.getElementById('app');
const root = createRoot(container);
root.render(<App />);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment