@gdjiami/hooks
Version:
react hooks for mygzb.com
12 lines (11 loc) • 343 B
TypeScript
export interface UseIntervalOptions {
startImmediate?: boolean;
duration?: number;
callback?: (count: number) => void;
}
export default function useInterval({ startImmediate, callback, duration, }: UseIntervalOptions): {
intervalId: number | null;
state: boolean;
start: () => void;
stop: () => void;
};