React.js: Example in tutorial not working

后端 未结 7 1089
陌清茗
陌清茗 2020-12-29 01:45

I\'m doing the React.js tutorial from http://facebook.github.io/react/docs/tutorial.html. Here are my files:

template.html:


    

        
7条回答
  •  滥情空心
    2020-12-29 02:17

    Chrome doesn't let you load file:// urls via XHR (which as mentioned elsewhere is how the in browser transform works). You have a couple options:

    • Use a different browser. I know Firefox works.
    • Start a local web server (Python ships with one, so if you have that installed it's very simple - http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python).
    • Put the script inline instead of in a separate file. That's doable for something simple like this but you'll want to try one of the other options as your code gets more complicated.

提交回复
热议问题