添加定时器
  componentDidMount() {
    this.timerID = setInterval(
      () => this.tick(),
      1000
    );
  }

 删除定时器

  componentWillUnmount() {
    clearInterval(this.timerID);
  }

  

 

相关文章:

  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2021-07-12
  • 2022-12-23
猜你喜欢
  • 2021-06-24
  • 2021-11-11
  • 2022-12-23
  • 2021-04-04
  • 2021-12-27
  • 2021-07-12
  • 2021-12-09
相关资源
相似解决方案