# useInfiniteRead

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

Reads an indexer list page by page, such as a name's subnames or an account's names. Signature, result and examples for useInfiniteRead.

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

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

Reads an indexer list page by page, such as a name's subnames or an account's names.

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

Use for "load more" lists and infinite scroll. A write touching the list's name or account
starts it over once the indexer has caught up. Pass `undefined` options (or `enabled: false`)
to wait, e.g. until a name is typed.

## Signature [#signature]

```ts
function useInfiniteRead<action extends PageAction>(action: action, options: Omit<ActionOptions<action>, "cursor"> | undefined, config: { /** * Load the list. Passing `undefined` options also disables it. * * @default true */ readonly enabled?: boolean | undefined; readonly client?: Ensforge.Client | undefined; } = {}): InfiniteReadResult<ActionValue<action>, ActionError<action>>
```

## Examples [#examples]

```tsx title="Subnames with \"Load more\""
import { Actions } from "@ensforge/sdk"
import { useInfiniteRead } from "@ensforge/react"

function Subnames({ name }: { name: string }) {
  const { items, hasMore, loadMore } = useInfiniteRead(Actions.indexer.getSubnames, { name })
  return (
    <>
      {items.map((item) => <p key={item.name}>{item.name}</p>)}
      {hasMore && <button onClick={loadMore}>Load more</button>}
    </>
  )
}
```

## See also [#see-also]

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