Documentation for agents: an index at /llms.txt, every docs page in one file at /llms-full.txt, and Markdown for any docs page by adding .md to its URL.

Skip to Content
ensforgeReact

useReads

Runs several reads at once; their RPC calls share the client's multicall batches. Signature, options, result and examples for useReads in @ensforge/react.

Read hookstable
Since v1.0.0View source

Runs several reads at once; their RPC calls share the client's multicall batches.

When to use

Use for a list of reads whose length changes, such as an avatar per row. For a fixed set, separate hooks read just as well.

Signature

function useReads<const reads extends readonly ReadSpec[]>(reads: reads, config: Omit<ReadConfig, "enabled"> = {}): ReadsResult<reads>

Examples

Addresses of several names
import { Actions } from "@ensforge/sdk"
import { useReads } from "@ensforge/react"

function Addresses({ names }: { names: readonly string[] }) {
  const results = useReads(names.map((name) => [Actions.record.getAddress, { name }] as const))
  return <ul>{results.map((result, index) => <li key={names[index]}>{result.data}</li>)}</ul>
}

See also

  • The hook types: ReadResult, WriteResult and ReadConfig.

Was this page helpful?