+ 1
How to use React with a CDN
I'm trying to use React in Brackets. I am using a CDN and using the same technique as Sololearn: //</script><script type="text/babel"> ReactDOM.render( <h1>Hello!</h1>, document.getElementById("root") ) But it keeps coming up with errors like "ReactDOM is used before assignment", when I used const it said "const is a reserved word". How can I get React to work with babel script and React cdns
1 Odpowiedź
+ 2
You should not use following format for react that run on html/js files
//</script><script type="text/babel">
You should use following format instead:
<script type="text/babel">
ReactDOM.render(
<h1>Hello!</h1>,
document.getElementById("root")
)
</script>
Remember to include react, react-dom abd babel js in head tag