I'm trying to learn react and have this simple template from the getting started guide:
<!DOCTYPE html>
<head>
<script src="https://unpkg.com/react@16/umd/react.production.min.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js" crossorigin></script>
<script src="https://unpkg.com/@babel/standalone@7.9.4/babel.min.js"></script>
<script type="text/babel" src="/main.js"></script>
</head>
<body>
<div id="root"></div>
</body>
</html>
main.js has this code:
console.log("Works!")
But this never runs. In fact, according to the devtools, it's not even being requested. Changing the type="text/babel"
to text/javascript
makes it run, but I can't use any JSX like that. I've also tried inlining the code and it still does not work.