Skip to content
IC Reactor

UseReactorMethodParameters

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

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.

Service = BaseActor

Method extends FunctionName<Service> = FunctionName<Service>

Transform extends TransformKey = "candid"

reactor: Reactor<Service, Transform>

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

The reactor instance to use for method calls


functionName: Method

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

The method name to call on the canister


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

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

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


optional callConfig?: CallConfig

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

Agent call configuration (effectiveCanisterId, etc.)


optional queryKey?: readonly unknown[]

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

Custom query key (auto-generated if not provided)


optional onSuccess?: (data) => void

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

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:76

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

ReactorReturnErr<Service, Method, Transform>

void


optional invalidateQueries?: readonly unknown[][]

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

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