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