Returns a memoized debounced function.
The arguments of the callback.
The return type of the callback.
The function to debounce.
The debounce delay in milliseconds.
Additional dependencies to recreate the debounced function.
Debounce options (leading, trailing, etc.).
The debounced function.
This hook wraps es-toolkit's debounce function. The callback is always up-to-date (via ref), so you don't need to include it in deps.
es-toolkit
debounce
const debouncedSearch = useDebounceCallback((query) => { search(query);}, 500); Copy
const debouncedSearch = useDebounceCallback((query) => { search(query);}, 500);
Returns a memoized debounced function.