useInterval
Runs a callback repeatedly at a specified millisecond interval, pausing when delay is null.
Loading preview...
The useInterval hook executes a callback on a repeating timer and automatically pauses whenever delay is set to null, always invoking the latest callback without resetting the interval on every render.
Installation
Usage
Examples
Pausable Stopwatch
Pass null as the delay when paused so the interval is cleared until isRunning becomes true again.
Dynamic Tick Speed
Update the delay value reactively to speed up or slow down the interval on the fly.