warning.js Can only update a mounted or mounting component. This usually means you called setState, replaceState, or forceUpdate on an unmounted component. This is a no-op.
组件里出现以下问题怎么解决,为什么会产生这个警告,以后工作中该如何避免
billgo
#4
你应该是在 componentWillMound 阶段用了 setState , 如果实在要在这个阶段使用 setState 方法,那么可以把这个 setState 写成一个方法,然后在 componentWillMount 阶段调用这个方法即可。