首页 > react报错 `inst.render is not a function`

react报错 `inst.render is not a function`

照着官网的例子在写,不知道哪里错了?

报了这么一个错误,求教是那里的问题?

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Hello React!</title>
    <script src="http://static.runoob.com/assets/react/react-0.14.7/build/react.js"></script>
    <script src="http://static.runoob.com/assets/react/react-0.14.7/build/react-dom.js"></script>
    <script src="http://static.runoob.com/assets/react/browser.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  </head>
  <body>
    <div id="content"></div>
    <script type="text/babel">
var data = [
  {author: "Pete Hunt", text: "This is one comment"},
  {author: "Jordan Walke", text: "This is *another* comment"}
];

var CommentBox = React.createClass({
  render: function() {
    return (
      <div className="commentBox">
        <h1>Comments</h1>
        <CommentList data={this.props.data} />
        <CommentForm />
      </div>
    );
  }
});

var CommentList = React.createClass({
  render: function() {
    var commentNodes = this.props.data.map(function (comment) {
      return (
        <Comment author={comment.author}>
          {comment.text}
        </Comment>
      );
    });
    return (
      <div className="commentList">
        {commentNodes}
      </div>
    );
  }
});

var CommentForm=React.createClass({
  render:function(){
    return(
<div className='commentForm'>
Hello I am commentForm!
</div>
      )
  }
});

ReactDOM.render(
  <CommentBox data={data} />,
  document.getElementById('content')
);
    </script>
  </body>
</html>

Import Reactdom from react

然后检查webpack里的loader


<Comment 这组件没写吧。你代码拷全了么

【热门文章】
【热门文章】