React渲染函数的变化没有反映

时间:2016-04-11 05:28:58

标签: javascript reactjs

我的代码很简单:

var Comment = React.createClass({
  render: function() {
    return (
      <div className="comment">
        <h2 className="commentAuthor">
          hello {this.props.author}
        </h2>
        {marked(this.props.children.toString())}
      </div>
    );
  }
});

var CommentList = React.createClass({
  render: function() {
    return (
     <div className="commentList">
        <Comment author="John">Here is my comment</Comment>
      </div>
    );
  }
});

我对Comment的修改不会生效。但是,如果我将var的名称从Comment更改为CommentB,则更改将生效。

修改 我的HTML是

<html>
  <head>
    <meta charset="utf-8" />
    <title>React Tutorial</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react-dom.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.5/marked.min.js"></script>
  </head>
  <body>
    <div id="content"></div>
    <script type="text/babel" src="/js/editor.js"></script>
  </body>
</html>

我在python27webapp2以及jinja模板引擎上运行本地Google应用引擎。

是什么给出了?

0 个答案:

没有答案