SSE Hooks

useDebounceCallback

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

Installation

npx sse-tool add use-debounce-callback

Usage

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

NameTypeDescription
funcTThe callback function to be debounced.
delaynumberThe delay in milliseconds before the callback is invoked (default is 500 milliseconds).
optionsDebounceOptionsOptions to control the behavior of the debounced function.

Return Value

Returns DebouncedState.

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

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