useInterval

This hook provides an easy way to debounce any function, ensuring that it only executes after a specified delay.

Example

Params
paramDescriptionTypeDefault
callbackThe function to be executed at each interval.() => void-
delayThe delay between each execution of the callback in milliseconds. If null, the interval is paused.number | null-

API

Return
returnDescriptionTypeDefault
intervalRefA ref object that holds the interval ID, which can be used for manual management of the interval.React.MutableRefObject-