

Custom hook that creates an interval that invokes a callback function at a specified delay using the [`setInterval API`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval).

## Usage [#usage]

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

const handleInterval = () => {
  // Code to be executed at each interval
};
useInterval(handleInterval, 1000);
```

## API [#api]

### Signature [#signature]

```ts
declare function useInterval(callback: () => void, delay: number | null): void;
```

### Parameters [#parameters]

| Parameter  | Type            | Description                                  | Default                                                                                               |   |
| ---------- | --------------- | -------------------------------------------- | ----------------------------------------------------------------------------------------------------- | - |
| `callback` | `() =&gt; void` | The function to be invoked at each interval. | -                                                                                                     |   |
| `delay`    | \`number        | null\`                                       | The time, in milliseconds, between each invocation of the callback. Use `null` to clear the interval. | - |

### Return Value [#return-value]

| Value    | Type   | Description                 |
| -------- | ------ | --------------------------- |
| `return` | `void` | Value returned by the hook. |
