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

mac2022-06-30  112

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

转载于:https://www.cnblogs.com/zhouyu0001/p/11334695.html

最新回复(0)