Skip to content

useThrottle

jsxhook

useThrottle: throttle a changing value

Installation

$ bunx termuijs add use-throttle

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

Usage

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

API Reference

useThrottle

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