import type { DocumentNode } from "graphql"; import type { TypedDocumentNode } from "@graphql-typed-document-node/core"; import type { OperationVariables } from "../../core/index.js"; import type { LazyQueryHookOptions, LazyQueryResultTuple, NoInfer } from "../types/types.js"; /** * A hook for imperatively executing queries in an Apollo application, e.g. in response to user interaction. * * > Refer to the [Queries - Manual execution with useLazyQuery](https://www.apollographql.com/docs/react/data/queries#manual-execution-with-uselazyquery) section for a more in-depth overview of `useLazyQuery`. * * @example * ```jsx * import { gql, useLazyQuery } from "@apollo/client"; * * const GET_GREETING = gql` * query GetGreeting($language: String!) { * greeting(language: $language) { * message * } * } * `; * * function Hello() { * const [loadGreeting, { called, loading, data }] = useLazyQuery( * GET_GREETING, * { variables: { language: "english" } } * ); * if (called && loading) return
Loading ...
* if (!called) { * return * } * return