I have the following code in a file called index.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>
<script src="src/Test2.js" type="text/babel"></script>
</head>
<body>
<div id="asdf"></div>
<script type="text/babel">
class Test extends React.Component {
render() {
return (<h>asdf</h>);
}
}
ReactDOM.render(
<Test/>,
document.getElementById('asdf')
);
</script>
</body>
I am trying to use code I've put in a file called Text2.js which is in a folder called src however I get the following error when I run the above code in chrome:
browser.js:5773 Failed to load file:///Users/.../src/Test2.js: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
How can I fix this? Thanks
PS: here is my folder structure:
../reactTutorial
../reactTutorial/index.html
../reactTutorial/src
../reactTutorial/src/Test2.js
In case this is relavent I am on a mac, also here is the code in Text2.js:
var Test2 = React.createClass({
render: function() {
return <div>This is Test2</div>;
}
});