Multiple Components

一句话解释:利用modular components来组建新的components

Owner-Ownee VS. Parent-Child

举个🌰:

var Avatar = React.createClass({
  render: function() {
    return (
      <div>
        <PagePic pagename={this.props.pagename} />
        <PageLink pagename={this.props.pagename} />
      </div>
    );
  }
});
...
  • Avatar owns div,PagePic,PageLink
  • div is the parent(but not owner) of PagePic and PageLink

Ownership的重要之处在于:ownee相当于owner的prop,是immutable的,这样保证了ownee的UI的consistency

Child

Child Reconciliation

一句话解释:当每一次新的render触发时,React以一种神奇的方式来更新DOM结构

Dynamic Children

一句话解释:当children在每次render时有可能变化(数量)的时候,采用一种assiging key的方式

Data Flow

一句话解释:一种高效的one-way binding:owners 将 他所拥有的component的props设置为他用自己props或state计算出来的值,这种recursively传播数据的方式很高效,使得变化传播的速度非常快

results matching ""

    No results matching ""