Whenever I set the script type to text/babel or text/jsx, the document and window event listeners stop working, does anyone know why this happens and how could it be fixed?, thanks
If there is no solution is there any alternative to use babel and window listener together?
This is the html code:
<!DOCTYPE html>
<html lang="en">
<body>
<div id="root"></div>
<script src="https://unpkg.com/react@17/umd/react.production.min.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js" crossorigin></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<script src="dos.js" type="text/jsx"></script>
</body>
</html>
And this is the js code:
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
window.addEventListener('load', () => {
console.log('hi')
})