@supunlakmal/hooks
Version:
A collection of reusable React hooks
9 lines (8 loc) • 456 B
TypeScript
/**
* Custom hook for setting an interval that executes a callback function repeatedly.
* Handles clearing the interval automatically on unmount or when the delay changes.
*
* @param {() => void} callback The function to execute at each interval.
* @param {number | null} delay The interval duration in milliseconds. If null, the interval is not set/cleared.
*/
export declare const useInterval: (callback: () => void, delay: number | null) => void;