我为一个函数设置了一个间隔计时器,该函数将今天的日期设置为我在componenteDidMount中初始化的状态。虽然我清除了componentWillUnmount中的间隔,但在组件之间快速切换后,它仍然会出现一个错误(这就是我如何捕捉到错误)。To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method._isMounted = true; <----- tried
因此,当我的组件被重新呈现时,我试图通过实现'componentWillUnmount‘来销毁为获取数据而发送的调用,但是它不起作用,而且我的排序只有在数据被获取之后才能完成。componentWillUnmount() {}changeSortOrder() {
if (this.state.inAsc