react中给state赋予初始值(使用dva)

使用dva时,通过subscriptions中的setUp,根据路由去请求数据时,在setup函数结束时,页面上componentDidMount并不一定已经执行完,因为dispatch是异步执行,因此,如果想给state重新赋值,要使用componentWillRecieiveProps中使用setState

猜你喜欢

转载自www.cnblogs.com/zhouyu0001/p/11334695.html