📄 primereact/hooks/useinterval

File: useinterval.md | Updated: 11/15/2025

Source: https://primereact.org/hooks/useinterval/

Introducing PrimeReact v11 Alpha 🥁Learn More

useInterval

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