1
ReactIntermediate#hooks
useEffect runs side effects after render. With no array it runs after every render, with [] only after mount, and with dependencies whenever one of them changes. The returned function cleans up before the next run and on unmount.
useEffect(() => {
const id = setInterval(tick, 1000);
return () => clearInterval(id);
}, []);