Skip to content

Instantly share code, notes, and snippets.

@jsalonen
Last active February 6, 2019 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsalonen/1bb0f128c2f077390fa6d0575cbb83ee to your computer and use it in GitHub Desktop.
Save jsalonen/1bb0f128c2f077390fa6d0575cbb83ee to your computer and use it in GitHub Desktop.
class Clock extends Component {
componentDidMount() {
this.clockIntervalId = window.setInterval(() => {
console.log('tick');
}, 1000)
}
componentWillUnmount() {
window.clearInterval(this.clockIntervalId);
}
render() {
return (
<p>Clock is ticking...</p>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment