Skip to content

Commit d007dd7

Browse files
committed
Add new react 18 createRoot hook
1 parent 6a9f69f commit d007dd7

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/index.js

+19-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1-
import React from 'react';
2-
import ReactDOM from 'react-dom';
1+
// import React from 'react';
2+
// import ReactDOM from 'react-dom/client';
33
import './index.css';
44
import App from './App';
55
import reportWebVitals from './reportWebVitals';
66

7-
ReactDOM.render(
8-
<React.StrictMode>
9-
<App />
10-
</React.StrictMode>,
11-
document.getElementById('root')
12-
);
7+
import { createRoot } from 'react-dom/client';
8+
const container = document.getElementById('root');
9+
const root = createRoot(container);
10+
root.render(<App />);
11+
12+
// ReactDOM.render(
13+
// <React.StrictMode>
14+
// <App />
15+
// </React.StrictMode>,
16+
// document.getElementById('root')
17+
// );
18+
19+
// root.render(
20+
// <React.StrictMode>
21+
// <App />
22+
// </React.StrictMode>
23+
// );
1324

1425
// If you want to start measuring performance in your app, pass a function
1526
// to log results (for example: reportWebVitals(console.log))

0 commit comments

Comments
 (0)