mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 00:20:04 +01:00
Update Example render for React v18 (#24259)
This commit is contained in:
parent
b8cfda15e1
commit
e912da964d
|
|
@ -40,14 +40,14 @@ You can improve it by sending pull requests to [this repository](https://github.
|
|||
We have several examples [on the website](https://reactjs.org/). Here is the first one to get you started:
|
||||
|
||||
```jsx
|
||||
import { createRoot } from 'react-dom/client';
|
||||
|
||||
function HelloMessage({ name }) {
|
||||
return <div>Hello {name}</div>;
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<HelloMessage name="Taylor" />,
|
||||
document.getElementById('container')
|
||||
);
|
||||
const root = createRoot(document.getElementById('container'));
|
||||
root.render(<HelloMessage name="Taylor" />);
|
||||
```
|
||||
|
||||
This example will render "Hello Taylor" into a container on the page.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user