To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.in Header (at index.js:27)class Header extends Component { this.setState({refreshed: true}); }
componentWillUnm
我为一个函数设置了一个间隔计时器,该函数将今天的日期设置为我在componenteDidMount中初始化的状态。虽然我清除了componentWillUnmount中的间隔,但在组件之间快速切换后,它仍然会出现一个错误(这就是我如何捕捉到错误)。To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method._isMounted = true; <----- t