Skip to content

Instantly share code, notes, and snippets.

@jsalonen
Last active February 6, 2019 12:34
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/6c7ee93e9af495875380406f1af86fde to your computer and use it in GitHub Desktop.
Save jsalonen/6c7ee93e9af495875380406f1af86fde to your computer and use it in GitHub Desktop.
function Clock() {
React.useEffect(() => {
const clockIntervalId = window.setInterval(() => {
console.log('tick');
}, 1000);
return () => {
window.clearInterval(clockIntervalId);
};
}, []);
return (
<p>Clock is ticking...</p>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment