Created
April 16, 2022 23:46
-
-
Save thatisuday/3f990e2133ced770369250cd3499368f to your computer and use it in GitHub Desktop.
Creating root in React v18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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