# useAccountSubnames

A React hook for fetching subnames owned by a connected account.

***

## Usage

```typescript
import { useAccountSubnames } from '@justaname.id/react'

function AccountSubnamesComponent() {
  const { 
    accountSubnames, 
    isAccountSubnamesPending, 
    isAccountSubnamesFetching,
    isAccountSubnamesLoading,
    refetchAccountSubnames 
  } = useAccountSubnames()
  
  if (isAccountSubnamesLoading) return <div>Loading subnames...</div>
  
  return (
    <div>
      <h3>Your Subnames</h3>
      {accountSubnames?.map((record, index) => (
        <div key={index}>
          <strong>{record.ens}</strong>
          <p>{record.sanitizedRecords?.description}</p>
          <p>Claimed: {record.isClaimed ? 'Yes' : 'No'}</p>
        </div>
      ))}
      <button onClick={refetchAccountSubnames}>Refresh</button>
    </div>
  )
}
```

***

## Returns

[`UseAccountSubnamesResult`](https://github.com/JustaName-id/JustaName-sdk/blob/docs/docs/sdk/JustaName%20React%20SDK/interfaces/UseAccountSubnamesResult.md) - An object containing:

* `accountSubnames`: Array of `Records` objects containing subname data with `sanitizedRecords` property
* `isAccountSubnamesPending`: Boolean indicating if the data is being fetched
* `isAccountSubnamesFetching`: Boolean indicating if the data is being fetched
* `isAccountSubnamesLoading`: Boolean indicating if the data is loading
* `refetchAccountSubnames`: Function to manually refetch the data

## Parameters

* **params?**: [`UseConnectedWalletSubnamesOptions`](/sdk-reference/justaname-react-sdk/interfaces/useconnectedwalletsubnamesoptions.md) - Optional parameters for the hook

## Defined in

[packages/@justaname.id/react/src/lib/hooks/account/useAccountSubnames.ts:27](https://github.com/JustaName-id/JustaName-sdk/blob/dc845c10af242e3ca87d95ef392516ac0bfa8b95/packages/@justaname.id/react/src/lib/hooks/account/useAccountSubnames.ts#L27)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.justaname.id/sdk-reference/justaname-react-sdk/functions/useaccountsubnames.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
