updates to react 18 method createRoot

This commit is contained in:
Daniel Avila 2023-02-04 20:07:08 -05:00
parent 21a6a0587c
commit 5dc2d5efba

View file

@ -1,6 +1,10 @@
import React from 'react';
import reactDom from 'react-dom';
// import reactDom from 'react-dom'; ---> deprecated
import { createRoot } from 'react-dom/client';
import App from './src/App';
import './src/style.css';
reactDom.render(<App />, document.getElementById('root'));
const container = document.getElementById('root');
const root = createRoot(container); // createRoot(container!) if you use TypeScript
// reactDom.render(<App />, document.getElementById('root'));
root.render(<App />);