Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
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.5.66/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.