# useUpdateSubname

A React hook for updating subname records including text records, addresses, and content hash.

***

## Usage

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

function UpdateSubnameComponent() {
  const { updateSubname, isUpdateSubnamePending } = useUpdateSubname()
  
  const handleUpdate = async () => {
    await updateSubname({
      ens: 'alice.justaname.eth',
      text: [
        { key: 'description', value: 'Updated description' },
        { key: 'url', value: 'https://example.com' }
      ],
      addresses: [
        { address: '0x1234567890abcdef...', coinType: 60 }
      ]
    })
  }
  
  return (
    <button onClick={handleUpdate} disabled={isUpdateSubnamePending}>
      {isUpdateSubnamePending ? 'Updating...' : 'Update Subname'}
    </button>
  )
}
```

***

## Returns

An object containing:

* `updateSubname`: Function to update the subname records
* `isUpdateSubnamePending`: Boolean indicating if the update is in progress

## Parameters

* **params?**: Optional configuration object
  * `chainId?`: The chain ID to use (defaults to provider chain ID)

## Update Function Parameters

The `updateSubname` function accepts:

* `ens`: The ENS name to update (e.g., 'alice.justaname.eth')
* `text?`: Array of text records `{ key: string, value: string }[]`
* `addresses?`: Array of address records `{ address: string, coinType: number }[]`
* `contentHash?`: Content hash string (e.g., 'ipfs\://QmHash...')
* `chainId?`: Override the chain ID for this operation

## Defined in

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


---

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