score:0

i thought you could be using a html file without a server, so in that case when you try to import the file main.js you get an error, you could see an example working here: https://plnkr.co/edit/rlo7u99uvuf5hmzahhe4?p=preview

<!doctype html>
<html>

  <head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react-dom.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.js"></script>
    <link rel="stylesheet" href="style.css" />
  </head>

  <body>
    <div id="example"></div>
    <script src="script.js" type="text/babel"></script>
  </body>

</html>

try to use a server to render your html file and should work.

score:1

if you are using chromium based web browser, it will happen. you can try mozilla firefox or other mozilla based web browser. chrome will not allow react in this way. moreover, 'type' (text/babel) attribute for script tag is deprecated. so, it is highly recommended to use react server or other server that support react.


Related Query

More Query from same tag