react添加和删除定时器的地方

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

 删除定时器

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

  

 
posted @ 2017-12-05 14:32  javenLee  阅读(7561)  评论(0编辑  收藏  举报