# UseReactorMethodParameters

Defined in: [react/src/hooks/useActorMethod.ts:52](https://github.com/B3Pay/ic-reactor/blob/ad82a03d03149c25f0d0f63e453f62e284c28b02/packages/react/src/hooks/useActorMethod.ts#L52)

Configuration for useActorMethod hook.
Extends react-query's QueryObserverOptions with custom reactor params.

This is a unified hook that handles both query and mutation methods.
Query-specific options (like refetchInterval) only apply to query methods.
Mutation-specific options (like invalidateQueries) only apply to mutation methods.

`retry`, `retryDelay`, `networkMode` and `meta` decide how a call runs, so
they apply to both. An update method's call is a mutation: without a `retry`
here it follows the QueryClient's mutation defaults, which retry nothing
unless the app set `mutations.retry`, because each attempt runs the update
on the canister again. Its query defaults, such as `reactorRetry`, do not
apply to it.

## Extends

- `Omit`\<`QueryObserverOptions`\<[`ReactorQueryData`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/reactorquerydata/)\<[`ReactorReturnOk`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/reactorreturnok/)\<`Service`, `Method`, `Transform`\>\>, [`ReactorReturnErr`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/reactorreturnerr/)\<`Service`, `Method`, `Transform`\>, [`ReactorQueryData`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/reactorquerydata/)\<[`ReactorReturnOk`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/reactorreturnok/)\<`Service`, `Method`, `Transform`\>\>, [`ReactorQueryData`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/reactorquerydata/)\<[`ReactorReturnOk`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/reactorreturnok/)\<`Service`, `Method`, `Transform`\>\>, `QueryKey`\>, `"queryKey"` \| `"queryFn"`\>

## Type Parameters

### Service

`Service` = [`BaseActor`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/baseactor/)

### Method

`Method` *extends* [`FunctionName`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/functionname/)\<`Service`\> = [`FunctionName`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/functionname/)\<`Service`\>

### Transform

`Transform` *extends* [`TransformKey`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/transformkey/) = `"candid"`

## Properties

### reactor

> **reactor**: [`Reactor`](https://ic-reactor.b3pay.net/v3/libs/classes/reactor/)\<`Service`, `Transform`\>

Defined in: [react/src/hooks/useActorMethod.ts:67](https://github.com/B3Pay/ic-reactor/blob/ad82a03d03149c25f0d0f63e453f62e284c28b02/packages/react/src/hooks/useActorMethod.ts#L67)

The reactor instance to use for method calls

***

### functionName

> **functionName**: `Method`

Defined in: [react/src/hooks/useActorMethod.ts:70](https://github.com/B3Pay/ic-reactor/blob/ad82a03d03149c25f0d0f63e453f62e284c28b02/packages/react/src/hooks/useActorMethod.ts#L70)

The method name to call on the canister

***

### args?

> `optional` **args?**: [`ReactorArgs`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/reactorargs/)\<`Service`, `Method`, `Transform`\>

Defined in: [react/src/hooks/useActorMethod.ts:73](https://github.com/B3Pay/ic-reactor/blob/ad82a03d03149c25f0d0f63e453f62e284c28b02/packages/react/src/hooks/useActorMethod.ts#L73)

Arguments to pass to the method (optional for parameterless methods)

***

### callConfig?

> `optional` **callConfig?**: `CallConfig`

Defined in: [react/src/hooks/useActorMethod.ts:76](https://github.com/B3Pay/ic-reactor/blob/ad82a03d03149c25f0d0f63e453f62e284c28b02/packages/react/src/hooks/useActorMethod.ts#L76)

Agent call configuration (effectiveCanisterId, etc.)

***

### queryKey?

> `optional` **queryKey?**: readonly `unknown`[]

Defined in: [react/src/hooks/useActorMethod.ts:79](https://github.com/B3Pay/ic-reactor/blob/ad82a03d03149c25f0d0f63e453f62e284c28b02/packages/react/src/hooks/useActorMethod.ts#L79)

Custom query key (auto-generated if not provided)

***

### onSuccess?

> `optional` **onSuccess?**: (`data`) => `void`

Defined in: [react/src/hooks/useActorMethod.ts:88](https://github.com/B3Pay/ic-reactor/blob/ad82a03d03149c25f0d0f63e453f62e284c28b02/packages/react/src/hooks/useActorMethod.ts#L88)

Callback when the method call succeeds.
Works for both query and mutation methods.

A method's `undefined` result arrives as `null`, as in `useActorQuery`,
for query and update methods alike.

#### Parameters

##### data

[`ReactorQueryData`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/reactorquerydata/)\<[`ReactorReturnOk`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/reactorreturnok/)\<`Service`, `Method`, `Transform`\>\>

#### Returns

`void`

***

### onError?

> `optional` **onError?**: (`error`) => `void`

Defined in: [react/src/hooks/useActorMethod.ts:96](https://github.com/B3Pay/ic-reactor/blob/ad82a03d03149c25f0d0f63e453f62e284c28b02/packages/react/src/hooks/useActorMethod.ts#L96)

Callback when the method call fails.
Works for both query and mutation methods.

#### Parameters

##### error

[`ReactorReturnErr`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/reactorreturnerr/)\<`Service`, `Method`, `Transform`\>

#### Returns

`void`

***

### invalidateQueries?

> `optional` **invalidateQueries?**: [`InvalidationTarget`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/invalidationtarget/)\<`Service`, `Transform`\>[]

Defined in: [react/src/hooks/useActorMethod.ts:111](https://github.com/B3Pay/ic-reactor/blob/ad82a03d03149c25f0d0f63e453f62e284c28b02/packages/react/src/hooks/useActorMethod.ts#L111)

Queries to invalidate after a successful mutation.
Only applies to mutation methods (updates).

Each entry is a query key, a query object or query factory, or a
`{ functionName, args? }` method of `reactor`; see
[InvalidationTarget](https://ic-reactor.b3pay.net/v3/libs/type-aliases/invalidationtarget/). `undefined` entries are skipped.

The invalidation is awaited before `onSuccess` runs, as in
`useActorMutation` and `createMutation`, so `onSuccess` sees the
refetched data, and `call()` resolves once the invalidated queries in use
have refetched.