Hi
In the “render-HTML-elements-to-the-DOM” challenge of react i tried to use it into an html file. So, in i put
<!-- Load React. -->
<!-- Note: when deploying, replace "development.js" with "production.min.js". -->
<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
<div id="challenge-node"></div>
<!--
Syntax: ReactDOM.render(componentToRender, targetNode)
-->
<script>
const JSX = (
<div>
<h1>Hello World</h1>
<p>Lets render this to the DOM</p>
</div>
);
ReactDOM.render(JSX, document.getElementById('challenge-node'));
</script>
When i open on Chrome the file the followin error appears
Uncaught SyntaxError: Unexpected token <
… on div element at
const JSX = (
<div>
I tried then to put the js code into a separate file and i changed the js code into
<script type="type/babel" src="react-test.js"></script>
The error dissapeard but nothing is working.
Any idea for propper use the react library?
Thank you