我有几个React容器和组件完美运行,但我仍在学习和学习React。当我的函数componentDidMount运行在我正在处理的新组件中时,看起来组件所需的所有数据都可用于组件,但this.props.loading
设置为true
;反应:什么控制this.props.loading的价值?
componentDidMount() {
const a = 100; //breakpoint here
if (this.props.loading === false){
const {myDataID} = this.props;
this.fromID = Meteor.userId();
this.toID = myDataID;
this.subscribe(fromID, toID);
}
}
什么控制着this.props.loading
的值?如果this.props.loading
设置为false,componentDidMount会再次运行吗?