fuselage-hooks.usedebouncedupdates.md 1011 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@rocket.chat/fuselage-hooks](./fuselage-hooks.md) &gt; [useDebouncedUpdates](./fuselage-hooks.usedebouncedupdates.md)

## useDebouncedUpdates() function

Hook to debounce the state dispatcher function returned by hooks like `useState()` and `useReducer()`<!-- -->.

<b>Signature:</b>

```typescript
12
13
14
15
16
17
18
export declare function useDebouncedUpdates<S>([state, dispatch]: [S, DispatchWithoutAction], delay: number): [
    S,
    DispatchWithoutAction & {
        flush: () => void;
        cancel: () => void;
    }
];
19
20
21
22
23
24
25
26
27
28
29
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  \[state, dispatch\] | \[S, DispatchWithoutAction\] |  |
|  delay | number | the number of milliseconds to delay the dispatcher |

<b>Returns:</b>

30
\[ S, DispatchWithoutAction &amp; { flush: () =&gt; void; cancel: () =&gt; void; } \]
31
32
33

a state value and debounced dispatcher pair