UseReactorMethodResult
Defined in: react/src/hooks/useActorMethod.ts:99
Result type for useActorMethod hook. Provides a unified interface for both query and mutation methods.
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”data:
ReactorQueryData<ReactorReturnOk<Service,Method,Transform>> |undefined
Defined in: react/src/hooks/useActorMethod.ts:109
The returned data from the method call. A method’s undefined result is
null here, as in useActorQuery, so undefined only means no call has
settled yet.
isLoading
Section titled “isLoading”isLoading:
boolean
Defined in: react/src/hooks/useActorMethod.ts:113
Whether the method is currently executing
isPending
Section titled “isPending”isPending:
boolean
Defined in: react/src/hooks/useActorMethod.ts:116
Alias for isLoading - whether a mutation is pending
isError
Section titled “isError”isError:
boolean
Defined in: react/src/hooks/useActorMethod.ts:119
Whether there was an error
isSuccess
Section titled “isSuccess”isSuccess:
boolean
Defined in: react/src/hooks/useActorMethod.ts:122
Whether the method has successfully completed at least once
error:
ReactorReturnErr<Service,Method,Transform> |null
Defined in: react/src/hooks/useActorMethod.ts:125
The error if one occurred
isQuery
Section titled “isQuery”isQuery:
boolean
Defined in: react/src/hooks/useActorMethod.ts:128
Whether this is a query method (true) or mutation method (false)
functionType
Section titled “functionType”functionType:
FunctionType
Defined in: react/src/hooks/useActorMethod.ts:131
The function type (query, update, composite_query)
call: (
args?) =>Promise<ReactorQueryData<ReactorReturnOk<Service,Method,Transform>> |undefined>
Defined in: react/src/hooks/useActorMethod.ts:138
Call the method with optional arguments. For queries: triggers a refetch For mutations: executes the mutation with the provided args
Parameters
Section titled “Parameters”ReactorArgs<Service, Method, Transform>
Returns
Section titled “Returns”Promise<ReactorQueryData<ReactorReturnOk<Service, Method, Transform>> | undefined>
reset: () =>
void
Defined in: react/src/hooks/useActorMethod.ts:152
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
Section titled “Returns”void
refetch
Section titled “refetch”refetch: () =>
Promise<ReactorQueryData<ReactorReturnOk<Service,Method,Transform>> |undefined>
Defined in: react/src/hooks/useActorMethod.ts:157
For queries only: Refetch the query
Returns
Section titled “Returns”Promise<ReactorQueryData<ReactorReturnOk<Service, Method, Transform>> | undefined>
queryResult?
Section titled “queryResult?”
optionalqueryResult?:UseQueryResult<ReactorQueryData<ReactorReturnOk<Service,Method,Transform>>,ReactorReturnErr<Service,Method,Transform>>
Defined in: react/src/hooks/useActorMethod.ts:163
The raw query result (only available for query methods)
mutationResult?
Section titled “mutationResult?”
optionalmutationResult?:UseMutationResult<ReactorQueryData<ReactorReturnOk<Service,Method,Transform>>,ReactorReturnErr<Service,Method,Transform>,ReactorArgs<Service,Method,Transform>>
Defined in: react/src/hooks/useActorMethod.ts:169
The raw mutation result (only available for mutation methods)