Skip to content

Cant import React

I started learning about React and I have problem with importing the library.


    <div id="root"></div>
    <script src="" crossorigin></script>
    <script src="" crossorigin></script>
    <script src="script.js"></script>

script.js file:

import React from "react";
import ReactDOM from "react-dom";

ReactDOM.render(<h1> Hello World </h1>, document.getElementById("Root"))

Error I get when im opening the index file:

Cannot GET /ReactDOM%20%5E&%20JSX/index.html

I imported those 2 scripts from React site.


I noticed that the id on <div id="root"></div> is lowercase but in your JS script you’re selecting document.getElementById("Root") an uppercase id. document.getElementById is case sensitive, so your code will probably not render correctly.