useThrottle
jsxhook
useThrottle: throttle a changing value
Terminal
$termuijs render use-throttle
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
| Prop | Type | Default | Description |
|---|---|---|---|
initial | T | undefined | — | Initial value |
persist | boolean | false | Persist to storage |
key | string | — | Storage key |