Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/netzo/deps/usehooks-ts.ts>useDebounce

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
function useDebounce
Deprecated
Deprecated

useDebounce uses a naive setTimeout implementation and will be removed. For a more robust implementation, use useDebounceCallback for functions and useDebounceValue for primitive values instead. The new implementation uses lodash.debounce under the hood.

import { useDebounce } from "https://deno.land/x/netzo@0.4.72/deps/usehooks-ts.ts";

Custom hook for debouncing a value.

Examples

const debouncedSearchTerm = useDebounce(searchTerm, 300);

Type Parameters

T
  • The type of the value to be debounced.

Parameters

value: T
  • The value to be debounced.
optional
delay: number
  • The delay in milliseconds for debouncing. Defaults to 500 milliseconds.

Returns

The debounced value.