Skip to content
IC Reactor

UseReactorMethodParameters

Defined in: react/src/hooks/useActorMethod.ts:52

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.

Service = BaseActor

Method extends FunctionName<Service> = FunctionName<Service>

Transform extends TransformKey = "candid"

reactor: Reactor<Service, Transform>

Defined in: react/src/hooks/useActorMethod.ts:67

The reactor instance to use for method calls


functionName: Method

Defined in: react/src/hooks/useActorMethod.ts:70

The method name to call on the canister


optional args?: ReactorArgs<Service, Method, Transform>

Defined in: react/src/hooks/useActorMethod.ts:73

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


optional callConfig?: CallConfig

Defined in: react/src/hooks/useActorMethod.ts:76

Agent call configuration (effectiveCanisterId, etc.)


optional queryKey?: readonly unknown[]

Defined in: react/src/hooks/useActorMethod.ts:79

Custom query key (auto-generated if not provided)


optional onSuccess?: (data) => void

Defined in: react/src/hooks/useActorMethod.ts:88

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.

ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>

void


optional onError?: (error) => void

Defined in: react/src/hooks/useActorMethod.ts:96

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

ReactorReturnErr<Service, Method, Transform>

void


optional invalidateQueries?: InvalidationTarget<Service, Transform>[]

Defined in: react/src/hooks/useActorMethod.ts:111

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