Skip to main content
Version: 6.5


function useDebounce<T>(value: T, delay: number, updatable?: boolean): T;

Delays updating the parameters by debouncing. Useful to avoid spamming network requests when parameters might change quickly (like a typeahead field).

import { useDebounce } from '@rest-hooks/hooks';
import { useSuspense } from 'rest-hooks';

const debouncedFilter = useDebounce(filter, 200);
const data = useSuspense(MyEndpoint, { filter: debouncedFilter });

Part of @rest-hooks/hooks