Capítulo 76 de 80

Chapter 76: mutationOptions

Core Idea

The mutation-side identity-function helper — same purpose as queryOptions, letting a { mutationFn, ...options } definition be shared between useMutation call sites (and useIsMutating/queryClient.isMutating's mutationKey-based filters) with type inference preserved.

Key Concepts

  • Accepts: anything useMutation accepts (mutationFn, mutationKey, callbacks, retry, scope, etc.).

Connects To

  • Mutations / useMutation: the option shape this helper wraps.
  • queryOptions: the query-side counterpart with the same purpose.