Answer the question
In order to leave comments, you need to log in
Why doesn't babel work with a script connected via src?
<!Doctype>
<html>
<head>
<meta charset="UTF-8" />
<title>ReactStart</title>
<!-- Загрузим React. -->
<!-- Примечание: для деплоя на продакшен замените окончание «development.js» на «production.min.js». -->
<script src="https://unpkg.com/[email protected]/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js" crossorigin></script>
<!-- Для JSX -->
<script src="https://unpkg.com/[email protected]/babel.min.js"></script>
</head>
<body>
<div>
<div id="componentJSX"></div>
</div>
<!-- Загрузим наш React-компонент c JSX. (так не работает JSX)-->
<script type="text/babel" src="componentJSX.js"></script>
<!-- А так работает -->
<script type="text/babel" >
ReactDOM.render(<button>start</button>, document.getElementById('componentJSX'))
</script>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question