Size
0.40 kb
useInterval
setInterval reactified, with synchronization support.
Installation
Usage
Set an interval:
Pause the interval by setting the delay to null:
Execute immediately by setting the leading option to true:
Synchronize all intervals that share the same delay using the sync option:
API Reference
UseIntervalOptions
Options for the useInterval hook (3rd argument).
| Prop | Type | Default | 
|---|---|---|
sync? | boolean | false | 
leading? | boolean | false | 
UseIntervalReturn
Return value of the useInterval hook.
| Prop | Type | Default | 
|---|---|---|
reset | () => void | - | 
cancel | () => void | - | 
isPending | boolean | - |