Skip to main content
Version: 6.0

useDebounce()

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 { useResource } from 'rest-hooks';

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

Part of @rest-hooks/hooks