【问题标题】:Props change affecting previous components visited影响先前访问过的组件的道具更改
【发布时间】:2019-06-18 09:08:43
【问题描述】:

在注册过程中,我有 3 个屏幕 1.输入手机号码 2.进入OTP 3.输入用户资料 这里的问题是,当我在最后阶段点击完成按钮时,它会调度动作并且道具会更新,它还会更新第二个组件并收到错误消息

输入 Otp(第二个组件)

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

完成(第三部分)

this.props.register(Data)

【问题讨论】:

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


    【解决方案1】:

    控制台你 nextProps 并检查你的数据是否为空?

    componentWillReceiveProps(nextProps) {
        console.log(nextProps)
       }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-04
      • 1970-01-01
      • 1970-01-01
      • 2019-05-24
      相关资源
      最近更新 更多