解决dispatch 后在当前页面不能获取最新的this.props中的数据

因为dispatch为异步方法  。解决这个问题方法很多  出去添加定时器这种不是很优雅的方法  我们可以用

componentWillReceiveProps(nextProps) 这个生命周期  在这个生命周期中判断newtProps   和this.props  是否全等 如果不相同  就去用nextProps (为redux中最新的数据)中的值
这样就相对优雅的解决了 dispatch异步的问题 
jsHe 本着记录与分享的态度 更新  
原文地址:https://www.cnblogs.com/jshe/p/12192977.html