Skip to content

useDebounce

jsxhook

useDebounce: debounce a changing value

Installation

$ bunx termuijs add use-debounce

Copies the source into src/components/use-debounce/ and installs @termuijs/jsx.

Usage

ts
import { useDebounce } from '@termuijs/jsx'
ts
const { value, set, reset } = useDebounce({
  initial: undefined,
})

API Reference

useDebounce

PropTypeDefaultDescription
initialT | undefinedInitial value
persistbooleanfalsePersist to storage
keystringStorage key
#hook#use-debounce