Warning: 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.
in Category (created by Context.Consumer)
in Connect(Category) (created by Route)
in Route (at App.js:29)
in Switch (at App.js:21)
in div (at App.js:19)
in Router (created by BrowserRouter)
in BrowserRouter (at App.js:18)
in App (at src/index.js:22)
in Provider (at src/index.js:21)
大体意思就是说对于已经卸载的组件无法执行React状态更新。 它会导致应用程序出现内存泄漏问题。 要解决这个问题,我们要在componentWillUnmount
方法中取消所有订阅事件和异步任务。