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>useDebounceCallback

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Latest
function useDebounceCallback
import { useDebounceCallback } from "https://deno.land/x/netzo@0.5.108/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

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