Executes a given callback at specified intervals.
import { useInterval } from 'primereact/hooks';
Simple timer that is updated every second.
useInterval(
() => {
setSeconds((prevSecond) => (prevSecond === 59 ? 0 : prevSecond + 1)); //fn
},
1000, //delay (ms)
active //condition (when)
);