Type Alias: MutationOptions<TData, TError, TVariables>
MutationOptions<
TData
,TError
,TVariables
>:Omit
<UseMutationOptions
<TData
,TError
,TVariables
>,"mutationKey"
|"mutationFn"
>
See Tanstack Query - useMutation options.
Type Parameters
Type Parameter | Default type | Description |
---|---|---|
TData | unknown | The data returned. |
TError | unknown | The error returned. |
TVariables | unknown | The variables used in the mutation. |
See
Tanstack Query - useMutation
Example
useMutationHook({
mutation: {
onSuccess: (data, variables) => {
console.log('onSuccess callback', data, variables);
},
onError: (error) => {
console.log('onError callback', error);
},
},
})
Options
mutationKey
andmutationFn
are used internally and therefore not included as an options.
mutation: {
gcTime,
meta,
networkMode,
onError,
onMutate,
onSettled,
onSuccess,
retry,
retryDelay,
scope,
throwOnError,
}