我遇到一个问题,即您导航到页面并阿波罗检索数据。当apollo这样做并且您导航到另一个页面时,apollo不会取消请求并引发以下错误:
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
是否有任何方法可以取消或中止来自ComponentDidUnmount
的请求?
componentDidMount() {
this.props.client.query({ ... })
}
componentWillUnmount() {
// cancel or abort query here
}
谢谢!