atur interval dalam bereaksi menggunakan kait

useEffect(() => {
  const interval = setInterval(() => {
    console.log('This will run every second!');
  }, 1000);
  return () => clearInterval(interval);
}, []);
Lonely Lyrebird