因为我的应用程序正在从API中获取图像,并按照预期渲染结果。但是显示这个警告对这个项目来说是不完整的,给出的答案也不能解决我的问题。此外,在fetch调用中将信号作为参数传递,并在componentWillUnmount中使用AbortController.abort(),这是AbortController无法解决的问题 Warning: Can't perform a React state update on an unmounted c
有人能让我知道我在componentWillUnmount我的代码时遗漏了什么吗?错误是 Warning: Can't perform a React state update on an unmounted component.To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.我正在讨论的代码是; componentDidMount() {
if (t
state here or do something based on response i get .catch(error => { }) this.source.cancel('request cancelled');回到我的问题,为什么我要这样做,只是为了避免这个错误;
警告:不能在未挂载的组件上调用setState这是一个非操作,但它表示您的应