Interface UseMutationOptions<TData, TError, TVariables, TContext>

Construct a type with the properties of T except for those in type K.

interface UseMutationOptions {
    cacheTime?: number;
    context?: Context<undefined | QueryClient>;
    meta?: MutationMeta;
    mutationFn?: MutationFunction<TData, TVariables>;
    mutationKey?: MutationKey;
    networkMode?: NetworkMode;
    onError?: ((error, variables, context) => unknown);
    onMutate?: ((variables) => undefined | TContext | Promise<undefined | TContext>);
    onSettled?: ((data, error, variables, context) => unknown);
    onSuccess?: ((data, variables, context) => unknown);
    retry?: RetryValue<TError>;
    retryDelay?: RetryDelayValue<TError>;
    useErrorBoundary?: boolean | ((error) => boolean);
}

Type Parameters

  • TData = unknown

  • TError = unknown

  • TVariables = void

  • TContext = unknown

Hierarchy

Properties

cacheTime?: number
context?: Context<undefined | QueryClient>

Use this to pass your React Query context. Otherwise, defaultContext will be used.

mutationFn?: MutationFunction<TData, TVariables>
mutationKey?: MutationKey
networkMode?: NetworkMode
onError?: ((error, variables, context) => unknown)

Type declaration

    • (error, variables, context): unknown
    • Parameters

      • error: TError
      • variables: TVariables
      • context: undefined | TContext

      Returns unknown

onMutate?: ((variables) => undefined | TContext | Promise<undefined | TContext>)

Type declaration

    • (variables): undefined | TContext | Promise<undefined | TContext>
    • Parameters

      • variables: TVariables

      Returns undefined | TContext | Promise<undefined | TContext>

onSettled?: ((data, error, variables, context) => unknown)

Type declaration

    • (data, error, variables, context): unknown
    • Parameters

      • data: undefined | TData
      • error: null | TError
      • variables: TVariables
      • context: undefined | TContext

      Returns unknown

onSuccess?: ((data, variables, context) => unknown)

Type declaration

    • (data, variables, context): unknown
    • Parameters

      • data: TData
      • variables: TVariables
      • context: undefined | TContext

      Returns unknown

retry?: RetryValue<TError>
retryDelay?: RetryDelayValue<TError>
useErrorBoundary?: boolean | ((error) => boolean)

Type declaration

    • (error): boolean
    • Parameters

      • error: TError

      Returns boolean

Generated using TypeDoc