React,无法通过没有方法'mountComponentIntoNode'

Fab*_*ani 3 google-chrome-extension reactjs

我有一个看起来像这样的HTML:

<head>
  <script src="../js/vendor/jquery-2.1.0.js"></script>
  <script src="../js/vendor/react.js"></script>
  <script src="../js/jsx/todo.js"></script>
</head>
<body>
  <div id="ola"></div>
  <script src="../js/popup.js"></script>
</body>
Run Code Online (Sandbox Code Playgroud)

我的todo.js是来自http://facebook.github.io/react/的编译版TODO应用程序减去最后一行.

我的最后一个popup.js是:

$(function() {
  React.renderComponent(TodoApp, document.getElementById('ola'));
})
Run Code Online (Sandbox Code Playgroud)

但页面没有显示任何内容!控制台显示错误:

Uncaught TypeError: Object function (props, children) {
      var instance = new Constructor();
      instance.construct.apply(instance, arguments);
      return instance;
    } has no method 'mountComponentIntoNode' react.js:10052
Run Code Online (Sandbox Code Playgroud)

我真的不知道为什么会这样,我只是试图从网站上的例子重新创建.如果重要的话,它是镀铬扩展.

Fab*_*ani 5

啊,渲染上有一行错误!

popup.js应该是:

React.renderComponent(TodoApp(), document.getElementById('ola'));
Run Code Online (Sandbox Code Playgroud)

  • 接得好.我会看看我们是否可以在React中针对这个特定情况发出一个很好的警告. (2认同)