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

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

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

Hook to create a debounced version of a callback function.

Examples

const debouncedCallback = useDebounceCallback( (searchTerm) => { // Perform search after user stops typing for 500 milliseconds searchApi(searchTerm); }, 500 );

// Later in the component debouncedCallback('react hooks'); // Will invoke the callback after 500 milliseconds of inactivity.

Type Parameters

T extends (...args: any) => ReturnType<T>
  • Type of the original callback function.

Parameters

func: T
  • The callback function to be debounced.
optional
delay: number
  • The delay in milliseconds before the callback is invoked (default is 500 milliseconds).
optional
options: DebounceOptions
  • Options to control the behavior of the debounced function.

Returns

DebouncedState<T>

A debounced version of the original callback along with control functions.