MutationResult
Defined in: react/src/types.ts:915
Result from createMutation.
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”useMutation
Section titled “useMutation”useMutation: <
TOnMutateResult>(options?) =>UseMutationResult<ReactorReturnOk<Service,Method,Transform>,ReactorReturnErr<Service,Method,Transform>,ReactorArgs<Service,Method,Transform>,TOnMutateResult>
Defined in: react/src/types.ts:930
React hook for the mutation. Accepts options to override/extend the factory config.
Type Parameters
Section titled “Type Parameters”TOnMutateResult
Section titled “TOnMutateResult”TOnMutateResult = unknown
Parameters
Section titled “Parameters”options?
Section titled “options?”MutationHookOptions<Service, Method, Transform, TOnMutateResult>
Returns
Section titled “Returns”UseMutationResult<ReactorReturnOk<Service, Method, Transform>, ReactorReturnErr<Service, Method, Transform>, ReactorArgs<Service, Method, Transform>, TOnMutateResult>
Example
Section titled “Example”// With invalidateQueries to auto-update balance after transferconst { mutate } = icpTransferMutation.useMutation({ invalidateQueries: [userBalanceQuery], // Auto-invalidate after success!})execute
Section titled “execute”execute: (
args) =>Promise<ReactorReturnOk<Service,Method,Transform>>
Defined in: react/src/types.ts:945
Execute the update call outside React. It runs in the QueryClient’s
MutationCache with the factory’s options and callbacks, as useMutation()
does without hook options. It resolves with the method’s result and
rejects with the call’s error.
Parameters
Section titled “Parameters”ReactorArgs<Service, Method, Transform>
Returns
Section titled “Returns”Promise<ReactorReturnOk<Service, Method, Transform>>