About Lesson
We had learned that ReactDOM.render()
can render some thing to web page. Now let’s try to change the default content in the root node to render a new object.
Remove <App />
and add our new code to show “hello world” on the web page:
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<h1>hello world</h1>
</React.StrictMode>
);
See the result on your browser after run npm run start
.
![](https://mlqgumimr9j8.i.optimole.com/w:587/h:261/q:mauto/ig:avif/https://www.weiy.cc/wp-content/uploads/2024/05/image-9.png)
You can also use our online tool to write code and see the effect if you have not real development environment.