

Custom hook that dynamically loads scripts and tracking their loading status.

## Usage [#usage]

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

const scriptStatus = useScript('https://example.com/script.js', { removeOnUnmount: true });
// Access the status of the script loading (e.g., 'loading', 'ready', 'error').
```

## API [#api]

### Signature [#signature]

```ts
declare function useScript(src: string | null, options?: UseScriptOptions): UseScriptStatus;
```

### Parameters [#parameters]

| Parameter   | Type               | Description                                                   | Default                                                                                    |   |
| ----------- | ------------------ | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | - |
| `src`       | \`string           | null\`                                                        | The source URL of the script to load. Set to `null` or omit to prevent loading (optional). | - |
| `[options]` | `UseScriptOptions` | Additional options for controlling script loading (optional). | -                                                                                          |   |

### Return Value [#return-value]

| Value    | Type              | Description                                                                                   |
| -------- | ----------------- | --------------------------------------------------------------------------------------------- |
| `return` | `UseScriptStatus` | The status of the script loading, which can be one of 'idle', 'loading', 'ready', or 'error'. |
