Component evidence
React hook for performing mutations with optimistic updates, error handling, and query invalidation.
// Source: https://github.com/TanStack/query | License: MIT | Copyright 2021-present Tanner Linsley
// Provided via justclaw.it.com; keep this notice with the code.
'use client'
import * as React from 'react'
import {
MutationObserver,
noop,
notifyManager,
shouldThrowError,
} from '@tanstack/query-core'
import { useQueryClient } from './QueryClientProvider'
import type {
UseMutateFunction,
UseMutationOptions,
UseMutationResult,
} from './types'
import type { DefaultError, QueryClient } from '@tanstack/query-core'
// HOOK
/**
* Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
* `useMutation` is the hook for that.
* @param options - The {@link UseMutationOptions} to use — everything you can pass to `useMutation`.
*
... (truncated -- full source via MCP)