SSE Hooks

useDebounceCallback

GitHub
Custom hook that creates a debounced version of a callback function.

Installation

npx sse-hooks add use-debounce-callback

Usage

example.ts
import { useDebounceCallback } from "./{hooks file}";

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.

API

Parameters

Prop Default Type
options-

DebounceOptions

Options to control the behavior of the debounced function.

func-

T

The callback function to be debounced.

delay

500

number

The delay in milliseconds before the callback is invoked (default is 500 milliseconds).

Returns

Return Value Default Type
return-

(args: Parameters<T>) => ReturnType<T> | undefined & ControlFunctions

Hook return value

Types Aliases

No specific type aliases defined for this component.

Changelog

c165d — feat: enhance useRoleGuard and useSSR hooks with additional options and documentation

30da4 — feat: add new hooks and their metadata

cf13e — feat: add custom hooks for step navigation, ternary dark mode, timeout, toggle, unmount, and window size

Built with Love • © 2026