📜  每秒反应刷新页面 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:37.396000             🧑  作者: Mango

代码示例1
componentDidMount() {
  this.interval = setInterval(() => this.setState({ time: Date.now() }), 1000);
}
componentWillUnmount() {
  clearInterval(this.interval);
}