useIntervalFn
A React Hook that create a function that will be called every interval
milliseconds.
Demo
Usage
See API for more details.
Source
Click links below to view source on GitHub.
API
const controls = useIntervalFn(callback, interval, options)
Callback
A function
that will be called every interval
milliseconds.
Interval
A number
representing the interval in milliseconds.
Options
export interface UseIntervalFnOptions {
/**
* Whether to start the interval immediately on mounted
*
* @defaultValue true
*/
immediate?: boolean
/**
* Whether to execute the callback immediately before the interval starts
*
* @defaultValue false
*/
immediateCallback?: boolean
}
Returns
Retuerns contain Pausable instance that can be paused, resumed.
See Pausable for more details.
export type UseIntervalFnReturns = Pausable