Skip to content

Commit 44c52cc

Browse files
committed
docs: migrate ReactDOM.render to createRoot for React 18+
1 parent 790625f commit 44c52cc

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

public/html/single-file-example.html

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111
</head>
1212
<body>
1313
<div id="root"></div>
14-
<script type="text/babel">
15-
16-
ReactDOM.render(
17-
<h1>Hello, world!</h1>,
18-
document.getElementById('root')
19-
);
20-
21-
</script>
14+
<script type="text/javascript">
15+
const root = ReactDOM.createRoot(document.getElementById('root'));
16+
root.render(
17+
<h1>Hello, world!</h1>
18+
);
19+
</script>
2220
<!--
2321
Note: this page is a great way to try React but it's not suitable for production.
2422
It slowly compiles JSX with Babel in the browser and uses a large development build of React.

0 commit comments

Comments
 (0)