

Custom hook that creates a debounced version of a callback function.

## Usage [#usage]

```tsx
import { useDebounceCallback } from "@tilt-legal/cubitt-components/utilities/hooks";

const debouncedCallback = useDebounceCallback(
  (searchTerm) => {
    // Perform search after user stops typing for 500 milliseconds
    searchApi(searchTerm);
  },
  500
);

// Later in the component
debouncedCallback('react hooks'); // Will invoke the callback after 500 milliseconds of inactivity.
```

## API [#api]

### Signature [#signature]

```ts
declare function useDebounceCallback<T extends (...args: any) => ReturnType<T>>(func: T, delay?: number, options?: DebounceOptions): DebouncedState<T>;
```

### Parameters [#parameters]

| Parameter   | Type              | Description                                                               | Default |
| ----------- | ----------------- | ------------------------------------------------------------------------- | ------- |
| `func`      | `T`               | The callback function to be debounced.                                    | -       |
| `delay`     | `number`          | The delay in milliseconds before the callback is invoked ( milliseconds). | 500     |
| `[options]` | `DebounceOptions` | Options to control the behavior of the debounced function.                | -       |

### Return Value [#return-value]

| Value    | Type                      | Description                                                                |
| -------- | ------------------------- | -------------------------------------------------------------------------- |
| `return` | `DebouncedState&lt;T&gt;` | A debounced version of the original callback along with control functions. |
