use-state-debounced
Version:
useStateDebounced - React debounced state hook
8 lines (5 loc) • 331 B
text/typescript
import { Dispatch, SetStateAction } from 'react';
type ReturnType<S> = [S, S, Dispatch<SetStateAction<S>>];
declare function useStateDebounced<S>(delay: number, initialState: S | (() => S)): ReturnType<S>;
declare function useStateDebounced<S = undefined>(delay: number): ReturnType<S | undefined>;
export { useStateDebounced };