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

useRecords

Reads any mix of a name's records in one request; the result has exactly the requested fields. Signature, result and examples for useRecords.

Read hookstable
Since v1.0.0View source

Reads any mix of a name's records in one request; the result has exactly the requested fields. Preset of useRead(Actions.record.get, …).

It wraps record.get: the same options, result and errors.

Signature

function useRecords<const options extends Actions.record.get.Options>(options: options | undefined, config?: ReadConfig): ReadResult<Actions.record.get.ReturnType<options>, Actions.record.get.ErrorType>

Examples

A profile card
import { useRecords } from "@ensforge/react"

function Profile() {
  const { data } = useRecords({ name: "nick.eth", texts: ["url", "avatar"], addresses: ["eth"] })
  return <span>{data?.texts.url}</span>
}

See also

  • The hook types: ReadResult, WriteResult and ReadConfig.

Was this page helpful?