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.
Extends
Section titled “Extends”Omit<QueryObserverOptions<ReactorQueryData<ReactorReturnOk<Service,Method,Transform>>,ReactorReturnErr<Service,Method,Transform>,ReactorQueryData<ReactorReturnOk<Service,Method,Transform>>,ReactorQueryData<ReactorReturnOk<Service,Method,Transform>>,QueryKey>,"queryKey"|"queryFn">
Type Parameters
Section titled “Type Parameters”Service
Section titled “Service”Service = BaseActor
Method
Section titled “Method”Method extends FunctionName<Service> = FunctionName<Service>
Transform
Section titled “Transform”Transform extends TransformKey = "candid"
Properties
Section titled “Properties”reactor
Section titled “reactor”reactor:
Reactor<Service,Transform>
Defined in: react/src/hooks/useActorMethod.ts:47
The reactor instance to use for method calls
functionName
Section titled “functionName”functionName:
Method
Defined in: react/src/hooks/useActorMethod.ts:50
The method name to call on the canister
optionalargs?:ReactorArgs<Service,Method,Transform>
Defined in: react/src/hooks/useActorMethod.ts:53
Arguments to pass to the method (optional for parameterless methods)
callConfig?
Section titled “callConfig?”
optionalcallConfig?:CallConfig
Defined in: react/src/hooks/useActorMethod.ts:56
Agent call configuration (effectiveCanisterId, etc.)
queryKey?
Section titled “queryKey?”
optionalqueryKey?: readonlyunknown[]
Defined in: react/src/hooks/useActorMethod.ts:59
Custom query key (auto-generated if not provided)
onSuccess?
Section titled “onSuccess?”
optionalonSuccess?: (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.
Parameters
Section titled “Parameters”ReactorQueryData<ReactorReturnOk<Service, Method, Transform>>
Returns
Section titled “Returns”void
onError?
Section titled “onError?”
optionalonError?: (error) =>void
Defined in: react/src/hooks/useActorMethod.ts:76
Callback when the method call fails. Works for both query and mutation methods.
Parameters
Section titled “Parameters”ReactorReturnErr<Service, Method, Transform>
Returns
Section titled “Returns”void
invalidateQueries?
Section titled “invalidateQueries?”
optionalinvalidateQueries?: readonlyunknown[][]
Defined in: react/src/hooks/useActorMethod.ts:82
Query keys to invalidate after a successful mutation. Only applies to mutation methods (updates).