werkbank
    Preparing search index...
    • Returns a memoized debounced function.

      Type Parameters

      • Args extends unknown[]

        The arguments of the callback.

      • Return = unknown

        The return type of the callback.

      Parameters

      • cb: Callback<Args, Return>

        The function to debounce.

      • timeout: number = 0

        The debounce delay in milliseconds.

      • dep: Dep = []

        Additional dependencies to recreate the debounced function.

      • options: DebounceOptions | undefined = {}

        Debounce options (leading, trailing, etc.).

      Returns DebouncedFunction<Callback<Args, Return>>

      The debounced function.

      This hook wraps es-toolkit's debounce function. The callback is always up-to-date (via ref), so you don't need to include it in deps.

      const debouncedSearch = useDebounceCallback((query) => {
      search(query);
      }, 500);