# useRead

> For the complete documentation index, see [llms.txt](https://ensforge.com/llms.txt).

Reads with any ensforge action and keeps the result fresh. Signature, options, result and examples for useRead in @ensforge/react.

Source: https://ensforge.com/docs/reference/react/use-read

<ApiMeta kind="Read hook" stability="stable" since="1.0.0" source="packages/react/src/hooks/useRead.ts#L65" />

Reads with any ensforge action and keeps the result fresh.

## When to use [#when-to-use]

Use for any read, from either `@ensforge/sdk` or `@ensforge/sdk/effect`. Named hooks such as
`useAddress` are presets of this one.

## Details [#details]

- Components reading the same action and options share one request and one cached result.
- Unmounting keeps the result, and a request in flight, cached for `idleTTL`; a remount within
  it reuses them, and retries a failed read. Writes that touch the read's names or accounts
  refetch it.
- Pass `undefined` options (or `enabled: false`) to wait, e.g. until a name is typed.

## Signature [#signature]

```ts
function useRead<action extends Action>(action: action, options: ActionOptions<action> | undefined, config: ReadConfig = {}): ReadResult<ActionValue<action>, ActionError<action>>
```

## Examples [#examples]

```tsx title="Reading a role"
import { Actions } from "@ensforge/sdk"
import { useRead } from "@ensforge/react"

function CanEdit({ name, account }: { name: string; account: `0x${string}` }) {
  const { data, isLoading } = useRead(Actions.permission.get, { name, account })
  return isLoading ? null : <span>{String(data?.can.setRecords)}</span>
}
```

## See also [#see-also]

- The [hook types](/docs/reference/react#types): `ReadResult`, `WriteResult` and `ReadConfig`.