I would like to achieve this behavior using signals:
useEffect(() => {
const interval = setInterval(() => {
console.log('This will run every second!');
}, 1000);
return () => clearInterval(interval);
}, []);
Do I need to compute first and then use effect according to their documentation? source: https://preactjs.com/guide/v10/signals/
Any tip will be appreciated, thanks.
There is no need to use compute here, you can go ahead and use effect. Count signal will be updated everytime interval fires.