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

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

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
function useDebounceValue
import { useDebounceValue } from "https://deno.land/x/netzo@0.5.107/deps/usehooks-ts.ts";

Returns a debounced version of the provided value, along with a function to update it.

Examples

const [debouncedValue, updateDebouncedValue] = useDebounceValue(inputValue, 500, { leading: true });

Type Parameters

T
  • The type of the value.

Parameters

initialValue: T | (() => T)
  • The value to be debounced.
delay: number
  • The delay in milliseconds before the value is updated (default is 500ms).
optional
options: { leading?: boolean; maxWait?: number; trailing?: boolean; equalityFn?: (left: T, right: T) => boolean; }
  • Optional configurations for the debouncing behavior.

Returns

[T, DebouncedState<(value: T) => void>]

An array containing the debounced value and the function to update it.