React not loading on atom-live-server

228 Views Asked by At

just getting started with React and I am building something very simple to verify that everything works. I have the following:

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

const element = <h1>Hi there!!!!</h1>
ReactDOM.render(element, document.getElementById("root"));
body { }
<html lang="en">
  <head>
    <title>Hey!</title>
  </head>
  <body>
    <div id='root'></div>
    <h1>Hi</h1>
    <script src="index.pack.js"></script>
  </body>
</html>

I am running this all from atom using live-server I can see the title and the header but the js script with react does not load. I checked with developer tools and the console does not report any errors, the network tab has no 4XX or 5XX codes. I found that a potential error could be "Uncaught SyntaxError: Cannot use import statement outside a module" from the code snippet tool here. Tried quite a few things but not really sure how to fix that.

I am probably missing something but not sure what. Any ideas?

0

There are 0 best solutions below