File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ We call this a “root” DOM node because everything inside it will be managed
88
99``` js
1010const element = < h1> Hello, world< / h1>
11- ReactDOM .render (element, document .getElementById (' root' ))
11+ ReactDOM .createRoot ( document .getElementById (' root' ));
1212```
1313
1414# React Element
@@ -27,7 +27,8 @@ class HelloWorld extends React.Component {
2727 }
2828}
2929
30- ReactDOM .render (< HelloWorld / > , document .getElementById (' root' ))
30+ const root = ReactDOM .createRoot (document .getElementById (' root' ));
31+ root .render (< HelloWorld / > );
3132```
3233
3334## A Simple function
@@ -43,5 +44,6 @@ const HelloWorld = () => {
4344 );
4445}
4546
46- ReactDOM .render (< HelloWorld / > , document .getElementById (' root' ))
47+ const root = ReactDOM .createRoot (document .getElementById (' root' ));
48+ root .render (< HelloWorld / > );
4749```
You can’t perform that action at this time.
0 commit comments