Decided to try React.

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>React</title> <script src="js/react.js"></script> <script src="js/react-dom.js"></script> <script src="js/babel.js"></script> </head> <body> <div id="root"></div> <script src="js/app.js" type="text/babel"></script> </body> 

And the script itself

 'use strict'; ReactDOM.render(<h1>Hi</h1>, document.getElementById('root')); 

An error is issued

 babel.js:12 Failed to load file:///.../js/app.js: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. 

What have I done wrong?

ps If I just write the code in the script tag, instead of connecting the file, then everything will work

  • You forgot to use the web server ... - Pavel Mayorov
  • parcel to help or webpack - Daniel Khoroshko
  • or create-react-app - Daniel Khoroshko

0