因为dispatch为异步方法 。解决这个问题方法很多 出去添加定时器这种不是很优雅的方法 我们可以用
componentWillReceiveProps(nextProps) 这个生命周期 在这个生命周期中判断newtProps 和this.props 是否全等 如果不相同 就去用nextProps (为redux中最新的数据)中的值
这样就相对优雅的解决了 dispatch异步的问题
因为dispatch为异步方法 。解决这个问题方法很多 出去添加定时器这种不是很优雅的方法 我们可以用
componentWillReceiveProps(nextProps) 这个生命周期 在这个生命周期中判断newtProps 和this.props 是否全等 如果不相同 就去用nextProps (为redux中最新的数据)中的值
这样就相对优雅的解决了 dispatch异步的问题