React 报错
Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
不能在组件销毁后设置state
解决方案
利用生命周期钩子函数:componentWillUnmount
componentWillUnmount(){
// 卸载异步操作设置状态
this.setState = (state, callback) => {
return;
}
}