道具更改会影响以前访问的组件

时间:2019-01-24 15:19:21

标签: reactjs react-native react-redux react-navigation

在注册过程中,我有3个屏幕  1.输入手机号码  2.输入Otp  3.输入用户数据    这里的问题是,当我在最后阶段按下完成按钮时,它将调度动作并更新道具,还会更新第二个组件并得到错误消息enter image description here

输入Otp(第二个组件)

 componentWillReceiveProps(nextProps) {
    console.log(nextProps.commonState.res.data.kada)
   }

完成(第三部分)

this.props.register(Data)

1 个答案:

答案 0 :(得分:0)

告诉您nextProps并检查数据是否为空?

componentWillReceiveProps(nextProps) {
    console.log(nextProps)
   }
相关问题