【问题标题】:React 0.13.1 rendering issueReact 0.13.1 渲染问题
【发布时间】:2015-04-12 16:26:36
【问题描述】:

我有一个非常简单的设置,但我无法使用 React 0.13.1 运行:

var TheApp = React.createClass({

  render: function() {
    return (
      React.createElement("div", null)
    )
  }
})

React.render(
  React.createElement(React.createFactory(TheApp)),
  document.getElementById('example')
)

我得到“未捕获的类型错误:无法读取未定义的属性 'mountComponent'”

我已阅读 React 0.13 中的更改,但我不明白为什么这不起作用。

JSBIN:http://jsbin.com/kepihamabi

【问题讨论】:

    标签: javascript reactjs


    【解决方案1】:
    React.render(
      React.createElement(React.createFactory(TheApp)),
      document.getElementById('example')
    )
    

    应该是

    React.render(
      React.createFactory(TheApp)(),
      document.getElementById('example')
    )
    

    【讨论】:

    • 谢谢,就是这样。文档/错误可能会更详细。
    猜你喜欢
    • 2021-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-04
    • 2019-03-01
    • 2023-04-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多