UNPKG

@mmcodemark/fuselage-hooks

Version:

React hooks for Fuselage, Rocket.Chat's design system and UI toolkit

32 lines 1.15 kB
import type { Dispatch, DispatchWithoutAction } from 'react'; /** * Hook to debounce the state dispatcher function returned by hooks like `useState()` and `useReducer()`. * * @param pair the state value and dispatcher function pair * @param delay the number of milliseconds to delay the dispatcher * @returns a state value and debounced dispatcher pair * @public */ export declare function useDebouncedUpdates<S>(pair: [state: S, dispatch: DispatchWithoutAction], delay: number): [ S, DispatchWithoutAction & { flush: () => void; cancel: () => void; } ]; /** * Hook to debounce the state dispatcher function returned by hooks like `useState()` and `useReducer()`. * * @param pair the state value and dispatcher function pair * @param delay the number of milliseconds to delay the dispatcher * @returns a state value and debounced dispatcher pair * @public */ export declare function useDebouncedUpdates<S, A>(pair: [state: S, dispatch: Dispatch<A>], delay: number): [ S, Dispatch<A> & { flush: () => void; cancel: () => void; } ]; //# sourceMappingURL=useDebouncedUpdates.d.ts.map