import type { DocumentNode } from "graphql"; import type { TypedDocumentNode } from "@graphql-typed-document-node/core"; import type { MutationHookOptions, MutationTuple, NoInfer } from "../types/types.js"; import type { ApolloCache, DefaultContext, OperationVariables } from "../../core/index.js"; /** * * * > Refer to the [Mutations](https://www.apollographql.com/docs/react/data/mutations/) section for a more in-depth overview of `useMutation`. * * @example * ```jsx * import { gql, useMutation } from '@apollo/client'; * * const ADD_TODO = gql` * mutation AddTodo($type: String!) { * addTodo(type: $type) { * id * type * } * } * `; * * function AddTodo() { * let input; * const [addTodo, { data }] = useMutation(ADD_TODO); * * return ( *
*
{ * e.preventDefault(); * addTodo({ variables: { type: input.value } }); * input.value = ''; * }} * > * { * input = node; * }} * /> * *
*
* ); * } * ``` * @since 3.0.0 * @param mutation - A GraphQL mutation document parsed into an AST by `gql`. * @param options - Options to control how the mutation is executed. * @returns A tuple in the form of `[mutate, result]` */ export declare function useMutation = ApolloCache>(mutation: DocumentNode | TypedDocumentNode, options?: MutationHookOptions, NoInfer, TContext, TCache>): MutationTuple; //# sourceMappingURL=useMutation.d.ts.map