Skip to content

Commit 2f9237e

Browse files
Noel Kim (김민혁)zhengjitf
Noel Kim (김민혁)
authored andcommitted
Update Example render for React v18 (facebook#24259)
1 parent 15f41f4 commit 2f9237e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ You can improve it by sending pull requests to [this repository](https://github.
4040
We have several examples [on the website](https://reactjs.org/). Here is the first one to get you started:
4141

4242
```jsx
43+
import { createRoot } from 'react-dom/client';
44+
4345
function HelloMessage({ name }) {
4446
return <div>Hello {name}</div>;
4547
}
4648

47-
ReactDOM.render(
48-
<HelloMessage name="Taylor" />,
49-
document.getElementById('container')
50-
);
49+
const root = createRoot(document.getElementById('container'));
50+
root.render(<HelloMessage name="Taylor" />);
5151
```
5252

5353
This example will render "Hello Taylor" into a container on the page.

0 commit comments

Comments
 (0)