I'm trying to learn React and I want to start with the simplest possible example. I got one from here: https://codeutopia.net/blog/2016/01/10/getting-started-with-react-the-easy-way/
But the code seems to refuse to load from the external .js file.
reacttest.html
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.js"></script>
</head>
<body>
<div id="app"></div>
<script src="main.js" type="text/babel">
// Code omitted to keep sample short
</script>
</body>
</html>
main.js
var App = React.createClass({
render: function() {
return <div>Something something Dark Side</div>;
}
});
ReactDOM.render(
<App />,
document.getElementById('app')
);
If I place the same code inside the script tags then it works fine. What am I doing wrong?