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 a useEffect cleanup function.
大致错误提示:无法对未装载的组件执行反应状态更新。这是一个不准的操作,但它表示应用程序内存泄漏。若要修复,请取消useffect清理函数中的所有订阅和异步任务。
hooks解决方法:
useEffect(() => {
let interTime = setInterval(() => {
getSystemResource()
}, 50000);
return () => {
clearInterval(interTime); // 解决内存泄漏,清除掉定时器
}
}, [])