setError:关于mountedRef的一点疑惑
来源:10-1 useCallback应用,优化异步请求

慕沐2022394
2021-12-01
老师您好!想问一下这边setError是不是也应该增加mountRef的判断呢,setError也会出现在卸载组件上赋值的问题吧🧐
if (mountedref.current) setError(error)
写回答
1回答
-
慕妹6538969
2022-03-06
可以用也可以不用,因为一般出现错误不会跳转页面
00
相似问题