> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://ensforge.com/api/mcp` to find what you need.

# useHcaHook

Inspect the configured hook. Uses the SDK from `EnsforgeProvider`.

## Import

```tsx
import { useHcaHook } from "@ensforge/react";
```

## Usage

:::code-group
```tsx [component.tsx]
import { useHcaHook } from "@ensforge/react";

function Component() {
  const result = useHcaHook({
    hca: "0x1234567890123456789012345678901234567890",
  });

  return (
    <pre>
      {JSON.stringify(
        result.data,
        (_, value) => (typeof value === "bigint" ? value.toString() : value),
        2,
      )}
    </pre>
  );
}
```

```tsx [provider.tsx]
// [!include ~/snippets/hca/provider.tsx]
```
:::

## Parameters

```ts
import type { UseEnsAtomParameters } from "@ensforge/react";
import type { HcaReadParameters } from "@ensforge/sdk/hca";
```

### hca

`` `0x${string}` ``

HCA address to inspect or operate on.

### blockNumber

`bigint | undefined`

Block number to read. Cannot be combined with blockTag.

### blockTag

`BlockTag | undefined`

Named block state to read. Cannot be combined with blockNumber.

### enabled

`boolean | undefined`

Defaults to `true`. Set it to `false` to keep the atom idle without executing the action.

### map

`(value: Success) => Mapped | undefined`

Maps successful data for this hook without changing the value stored by the underlying atom.

### atom

`EnsAtomOptions<Failure> | undefined`

Controls the Effect Atom lifecycle for this hook.

| Property          | Type                         | Default       | Description                                     |
| ----------------- | ---------------------------- | ------------- | ----------------------------------------------- |
| `idleTTL`         | `Duration.Input`             | `"5 minutes"` | Retains an unused atom before it is disposed.   |
| `refreshInterval` | `false \| Duration.Input`    | `false`       | Refreshes the atom while it remains subscribed. |
| `retry`           | `false \| Schedule`          | `false`       | Retries typed failures with an Effect schedule. |
| `swr`             | `false \| EnsAtomSwrOptions` | enabled       | Configures stale-while-revalidate behavior.     |

See [Atom Options](/react/api/atom-options) for focused examples.

## Return Type

```ts
type Result = ReturnType<typeof useHcaHook>;
```

Returns an [`EnsAtomResult`](/react/api/atom-result).

| Property        | Description                                             |
| --------------- | ------------------------------------------------------- |
| `data`          | Successful action data, or `undefined` before success.  |
| `error`         | Typed action failure, an unexpected `Error`, or `null`. |
| `cause`         | Complete Effect cause for the latest failure.           |
| `isInitial`     | No execution has completed yet.                         |
| `isWaiting`     | Initial or background work is running.                  |
| `isSuccess`     | The atom contains a successful value.                   |
| `isFailure`     | The atom contains a failed result.                      |
| `refresh`       | Refreshes the atom and returns a Promise.               |
| `refreshEffect` | Refreshes with a typed Effect error channel.            |
| `result`        | Underlying Effect `AsyncResult`.                        |
| `updatedAt`     | Timestamp of the latest successful value.               |

## Suspense

Use [`useHcaHookSuspense`](/react/api/hooks/hca/use-hca-hook-suspense) beneath Suspense and an error boundary.

## Effect Atom

```ts
import { getHcaHookAtom } from "@ensforge/react/atoms";
import { sdk } from "./client";

const atom = getHcaHookAtom(sdk, parameters, options);
```

## Action

* [`getHcaHook`](/core/api/actions/hca/get-hca-hook)
* [`sdk.hca.getHcaHook`](/sdk/api/hca/get-hca-hook)
