这可能是在可回答和自以为是之间徘徊,但随着复杂性的增加,我会反复讨论如何构建 ReactJS 组件,并且可以使用一些方向。
来自 AngularJS,我想将我的模型作为属性传递给组件,并让组件直接修改模型。或者我应该将模型拆分为各种state属性并在向上游发送时将其编译回一起?ReactJS 的方式是什么? 
以博客文章编辑器为例。尝试直接修改模型最终看起来像:
var PostEditor = React.createClass({
  updateText: function(e) {
    var text = e.target.value;
    this.props.post.text = text;
    this.forceUpdate();
  },
  render: function() {
    return (
      <input value={this.props.post.text} onChange={this.updateText}/>
      <button onClick={this.props.post.save}/>Save</button>
    );
  }
});
这似乎是错误的。
是否更像是 React 方式来制作我们的text模型属性state,并在保存之前将其编译回模型,例如:
var PostEditor = React.createClass({
  getInitialState: function() {
    return {
      text: ""
    };
  },
  componentWillMount: function() {
    this.setState({
      text: this.props.post.text
    });
  },
  updateText: function(e) {
    this.setState({
      text: e.target.value
    });
  },
  savePost: function() {
    this.props.post.text = this.state.text;
    this.props.post.save();
  },
  render: function() {
    return (
      <input value={this.state.text} onChange={this.updateText}/>
      <button onClick={this.savePost}/>Save</button>
    );
  }
});
这不需要调用this.forceUpdate(),但是随着模型的增长,(帖子可能有作者、主题、标签、评论、评级等),组件开始变得非常复杂。
