登陆后报了一个副作用的警告
来源:7-4 用useAsync获取用户信息
慕姐0416137
2021-03-27
老师老师,成功登录之后报了一个这样的错误。请问如何解决?
index.js:1 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 a useEffect cleanup function.
写回答
2回答
-
Nolan
2021-04-14
给其他遇到这个问题的同学:这个warning是由于异步造成的,后面会专门讲;如果大家现在就想解决的话,可以去最新的代码中,找到 use-async.ts 文件,看里面的 useSafeDispatch 部分
00 -
Nolan
2021-03-28
后面会专门讲的。。
012021-03-28
相似问题