> For the complete documentation index, see [llms.txt](https://docs.justaname.id/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.justaname.id/sdk-reference/justaname-react-sdk/functions/useacceptsubname.md).

# useAcceptSubname

A React hook for accepting subname invitations and managing the acceptance process.

***

## Usage

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

function AcceptSubnameComponent() {
  const { acceptSubname, isAcceptSubnamePending } = useAcceptSubname()
  
  const handleAccept = async () => {
    try {
      const result = await acceptSubname({
        ens: 'alice.justaname.eth',
        addresses: [{ coinType: '60', address: '0x1234...' }],
        text: [{ key: 'description', value: 'My subname' }]
      })
      console.log('Subname accepted:', result)
    } catch (error) {
      console.error('Error accepting subname:', error)
    }
  }
  
  return (
    <button onClick={handleAccept} disabled={isAcceptSubnamePending}>
      {isAcceptSubnamePending ? 'Accepting...' : 'Accept Subname'}
    </button>
  )
}
```

***

## Returns

[`UseAcceptSubnameResult`](/sdk-reference/justaname-react-sdk/interfaces/useacceptsubnameresult.md) - An object containing:

* `acceptSubname`: Function that returns a `Records` object with `sanitizedRecords` property
* `isAcceptSubnamePending`: Boolean indicating if the operation is in progress

## Parameters

* **params?**: [`UseAcceptSubnameParams`](/sdk-reference/justaname-react-sdk/type-aliases/useacceptsubnameparams.md) - Optional parameters for the hook

## Defined in

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/useacceptsubname.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.
