-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# useDebounce | ||
|
||
Debounce a value. | ||
|
||
```ts | ||
const debouncedValue = useDebounce(value, { timeout: 1000 }); | ||
``` | ||
|
||
## Parameters | ||
|
||
### value | ||
|
||
- Type: `T` | ||
|
||
The value to be debounced. | ||
|
||
### options | ||
|
||
- Type: `UseDebounceOptions<T>` | ||
- Default: `{}` | ||
|
||
The options to configure the hook. | ||
|
||
## Options | ||
|
||
### timeout | ||
|
||
- Type: `number` | ||
- Default: 500 | ||
|
||
The timeout in milliseconds between the last action of change and the actual time of that change being applied. | ||
|
||
Changes of this value will clear the current timer (with the old `timeout` value) and start a new one (with the new `timeout` value). | ||
|
||
### onMount | ||
|
||
- Type: `boolean` | ||
- Default: `false` | ||
|
||
Whether to immediately start debouncing after the component is mounted. | ||
|
||
## Returns | ||
|
||
- Type: `T` | ||
|
||
The debounced value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters