File: useinterval.md | Updated: 11/15/2025
Introducing PrimeReact v11 Alpha 🥁Learn More
SearchK
10.9.7
HOOK
API
Executes a given callback at specified intervals.
Import#
import { useInterval } from 'primereact/hooks';
Copy
Basic#
Simple timer that is updated every second.
0
Stop
useInterval(
() => {
setSeconds((prevSecond) => (prevSecond === 59 ? 0 : prevSecond + 1)); //fn
},
1000, //delay (ms)
active //condition (when)
);
Copy
Import
Basic
PrimeReact 10.9.7 by PrimeTek