use-interval
Calls function with a given interval
Import
Source
Docs
Package
Usage
Page loaded 0 seconds ago
Auto invoke interval
To automatically start interval when component is mounted, set autoInvoke
option to true
:
API
Arguments:
fn
– function that is called at each interval tickinterval
– amount of milliseconds between each tick
Return object:
start
– start intervalstop
– stop intervaltoggle
– toggle intervalactive
– current interval status