凤凰求蛊
例如点击按钮就新增一个子组件,同时需要使用ref引用子组件,我像下面这样把ref写在handleClick里面时,因为不在render里面,会报错:addComponentAsRefTo(...): Only a ReactOwner can have refs.var Father = React.createClass({getInitalState:function(){return {children:[]}},handleClick:function(){var childrenTemp = this.state.childrenthis.setState{children:childrenTemp.push(<Child ref="childRef">)}},render:function(){return (<div>{this.state.children}</div>)}})