<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [useDebounce](./x-components.usedebounce.md)

## useDebounce() function

Composable which wraps the function passed as parameter into a debounced function and returns it. It also cancels the debounced function when component is unmounted.

**Signature:**

```typescript
export declare function useDebounce<Params extends any[]>(fn: (...args: Params) => void, debounceTimeInMs: number, debounceOptions?: DebounceOptions): import("../utils/types").DebouncedFunction<Params>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  fn | (...args: Params) =&gt; void | Function to be debounced. |
|  debounceTimeInMs | number | Time of debounce in ms. |
|  debounceOptions | [DebounceOptions](./x-components.debounceoptions.md) | _(Optional)_ The options for the debounce strategy. |

**Returns:**

import("../utils/types").[DebouncedFunction](./x-components.debouncedfunction.md)<!-- -->&lt;Params&gt;

Debounced function obtained from `fn` parameter.

