useAvatar
Reads a name's avatar as an image URL, with NFT avatars resolved. Signature, options, result and examples for useAvatar in @ensforge/react.
Read hookstable
Since v1.0.0View source
Reads a name's avatar as an image URL, with NFT avatars resolved. Preset of useRead(Actions.record.getAvatar, …).
It wraps record.getAvatar: the same options, result and errors.
Signature
function useAvatar(options: Actions.record.getAvatar.Options | undefined, config?: ReadConfig): ReadResult<Actions.record.getAvatar.ReturnType, Actions.record.getAvatar.ErrorType>Examples
import { useAvatar } from "@ensforge/react"
function View() {
const { data: avatar } = useAvatar({ name: "nick.eth" })
return <img src={avatar ?? undefined} />
}See also
- The hook types:
ReadResult,WriteResultandReadConfig.
Was this page helpful?