标签: reactjs react-native expo react-navigation
您好,我正在从事React Native工作,并且在导航时遇到以下错误
错误:
无法在已卸载的组件上执行React状态更新。这是空操作,但它表明应用程序中发生内存泄漏。要修复,取消所有%s。%s中的所有订阅和异步任务,componentWillUnmount方法Error
这些是以下类的代码 主index.js class index.js Code
index.js class
启动画面代码Splash Code
登录屏幕代码 Login Screen Code
错误
enter image description here
答案 0 :(得分:1)
您可以看一下这篇文章:https://medium.com/@selvaganesh93/how-to-clean-up-subscriptions-in-react-components-using-abortcontroller-72335f19b6f7#:~:text=Warning%3A%20Can't%20perform%20a,tasks%20in%20the%20componentWillUnmount%20method.&text=in%20your%20application.-,To%20fix%2C%20cancel%20all%20subscriptions%20and%20asynchronous,in%20a%20useEffect%20cleanup%20function。
,也来自github: https://github.com/material-components/material-components-web-react/issues/434