# UseReactorMethodResult

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

Result type for useActorMethod hook.
Provides a unified interface for both query and mutation methods.

## 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

### data

> **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`\>\> \| `undefined`

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

The returned data from the method call. A method's `undefined` result is
`null` here, as in `useActorQuery`, so `undefined` means that no call has
settled yet, that the last call failed, or that an update call is
running. A query keeps its earlier data when a refetch fails.

***

### isLoading

> **isLoading**: `boolean`

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

Whether the method is currently executing

***

### isPending

> **isPending**: `boolean`

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

Alias for isLoading - whether a mutation is pending

***

### isError

> **isError**: `boolean`

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

Whether there was an error

***

### isSuccess

> **isSuccess**: `boolean`

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

Whether the method has successfully completed at least once

***

### error

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

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

The error if one occurred

***

### isQuery

> **isQuery**: `boolean`

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

Whether this is a query method (true) or mutation method (false)

***

### functionType

> **functionType**: [`FunctionType`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/functiontype/)

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

The function type (query, update, composite_query)

***

### call

> **call**: (`args?`) => `Promise`\<[`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`\>\> \| `undefined`\>

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

Call the method with optional arguments.
For queries: triggers a refetch
For mutations: executes the mutation with the provided args

For a query method, `call(args)` fetches those args from the canister
even when they are cached, and reports the result to `onSuccess` or
`onError` itself. `call()` refetches the hook's own args, as `refetch()`
does. Either resolves `undefined` when its fetch fails. A sign-in or
sign-out while either is in flight cancels the fetch, which then runs
again for the principal signed in, so the call resolves with that
principal's answer rather than the previous one's; see
`ClientManager.fetchAcrossIdentitySwitch`.

#### Parameters

##### args?

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

#### Returns

`Promise`\<[`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`\>\> \| `undefined`\>

***

### reset

> **reset**: () => `void`

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

Reset the state (data and error).
For queries: resets this hook's own cache entry to its initial state, so
`data` goes back to `initialData` when one was given and is cleared
otherwise. An enabled hook then refetches. Other args of the same method
are left alone.
For mutations: resets the mutation state

#### Returns

`void`

***

### refetch

> **refetch**: () => `Promise`\<[`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`\>\> \| `undefined`\>

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

For queries only: Refetch the query

Resolves with the answer, or `undefined` when the refetch fails, whose
error the hook reports to `onError`; `data` keeps the last answer. A
sign-in or sign-out while it is in flight makes it refetch for the
principal signed in, and it resolves with that principal's answer, as
`call()` does.

#### Returns

`Promise`\<[`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`\>\> \| `undefined`\>

***

### queryResult?

> `optional` **queryResult?**: `UseQueryResult`\<[`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`\>\>

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

The raw query result (only available for query methods)

***

### mutationResult?

> `optional` **mutationResult?**: `UseMutationResult`\<[`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`\>, [`ReactorArgs`](https://ic-reactor.b3pay.net/v3/libs/type-aliases/reactorargs/)\<`Service`, `Method`, `Transform`\>\>

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

The raw mutation result (only available for mutation methods)