Here is my HTML file:
<body>
<div id="root"></div>
<!-- Load React. -->
<!-- Note: when deploying, replace "development.js" with "production.min.js". -->
<script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>
</body>
This is my JavaScript file:
const root = ReactDOM.createRoot(
document.getElementById('root')
);
const element = <h1>Hello,world</h1>;
root.render(element);
According to this logic, the page should change, the h1 element will appear, but this page has not changed
>Solution :
Have you imported the necessary libraries (React and ReactDOM) ?