父组件更新,会触发子组件的整套更新生命周期,即:componentWillReceiveProps、componentDidUpdate。
但是如果子组件内部setstate的话,只会触发子组件内部的componentDidUpdate,不会触发子组件的componentWillReceiveProps。
componentWillReceiveProps只有props改变时才会触发,内部的state变化不会触发。
componentwillreceiveprops触发时机
最新推荐文章于 2023-02-23 20:36:53 发布