# useSetPrimaryNameForAddress

Hook for setting primary name for address.

## Import

```tsx
import { useSetPrimaryNameForAddress } from "@ensforge/react";
```

## Usage

```tsx
function Component() {
  const mutation = useSetPrimaryNameForAddress();

  return (
    <button
      disabled={mutation.isWaiting}
      onClick={() =>
        mutation.mutate({
          address: "0x0000000000000000000000000000000000000001",
          name: "example.eth",
        })
      }
    >
      Submit
    </button>
  );
}
```

## Parameters

```ts
import type { EnsMutationOptions } from "@ensforge/react";
```

The hook accepts an optional `EnsMutationOptions` object.

### retry

`false | Schedule<unknown, Failure> | undefined`

An Effect schedule used to retry typed failures. It defaults to `false`. Only retry writes that are
known to be safe and idempotent.

### onExit

`(exit: Exit<Success, Failure>, parameters: Parameters) => void`

Receives the complete Effect `Exit` and the exact mutation parameters after execution. Use
`Exit.match` or `Exit.isSuccess` to handle both outcomes without losing typed failures.

See [Mutation Options](/react/api/mutation-options) for schedules, provider defaults, and per-call
`onExit` handlers.

## Mutation Parameters

### address

`string`

Address used by the operation.

### name

`string`

ENS name used by the query or mutation.

### verifyForward

`boolean | undefined`

Value used for `verifyForward` by this operation.

## Return Type

Returns [`EnsMutationResult`](/react/api/mutation-result) with `mutate`, `mutateAsync`, `mutateEffect`, native `AsyncResult` state, data, cause, interruption, and reset.

```ts
type Result = ReturnType<typeof useSetPrimaryNameForAddress>;
```

## Effect Atom

```ts
import { createSetPrimaryNameForAddressMutationAtom } from "@ensforge/react/atoms";

const atom = createSetPrimaryNameForAddressMutationAtom(sdk);
```

The hook uses this atom with the SDK and registry from `EnsforgeProvider`.

## Action

* [`setPrimaryNameForAddress`](/core/api/actions/reverse/set-primary-name-for-address)
* [`sdk.reverse.setPrimaryNameForAddress`](/sdk/api/reverse/set-primary-name-for-address)
