useDebounceValue
Custom hook that returns a debounced version of the provided value, along with a function to update it.
Installation
npx sse-hooks add use-debounce-value
yarn dlx sse-hooks add use-debounce-value
pnpm dlx sse-hooks add use-debounce-value
deno run -A npm:sse-hooks add use-debounce-value
bunx sse-hooks add use-debounce-value
Usage
example.ts
import { useDebounceValue } from "./{hooks file}";
const [debouncedValue, updateDebouncedValue] = useDebounceValue(
inputValue,
500,
{ leading: true },
);
API
Parameters
| Prop | Default | Type |
|---|---|---|
options | - |
Optional configurations for the debouncing behavior.
|
initialValue | - |
The value to be debounced. |
delay | - |
The delay in milliseconds before the value is updated (default is 500ms). |
Returns
| Return Value | Default | Type |
|---|---|---|
[0] | - |
|
[1] | - |
|
Types Aliases
No specific type aliases defined for this component.