So I'm following this example to try to get React working on my computer.
https://gist.github.com/danawoodman/9cfddb1a0c934a35f31a
I note that I don't have access to a server and I can't install anything on this computer so I'm trying to get a site displaying just using the c: or file:// path.
This is my index.html code. Note I have saved the react, react-dom and browser scripts locally.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>React Hello World</title>
</head>
<body>
<div id='root'></div>
<script src="extfiles/react.js"></script>
<script src="extfiles/react-dom.js"></script>
<script src="extfiles/browser.min.js"></script>
<script src="extfiles/scripts.js" type="text/babel"></script>
</body>
</html>
My scripts.js file is simply
ReactDOM.render(<h1>Hello World</h1>, document.getElementById('root'));
I'm getting this error.
XMLHttpRequest cannot load file:///<path>/extfiles/scripts.js. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.transform.load @ browser.min.js:4
I understand why I'm getting this error from posts such as "Cross origin requests are only supported for HTTP." error when loading a local file.
What I don't understand is why I don't get this error loading up the react library but only when I load up my own files. Because if I change
<script src="extfiles/scripts.js" type="text/babel"></script>
to
<script type="text/babel">
ReactDOM.render(<h1>Hello World</h1>, document.getElementById('root'));
</script>
Then that works indicating to me that ReactDOM has been loaded.