@apollo/client

  • Version 3.9.11
  • Published
  • 6.7 MB
  • 14 dependencies
  • MIT license

Install

npm i @apollo/client
yarn add @apollo/client
pnpm add @apollo/client

Overview

A fully-featured caching GraphQL client.

Index

Variables

Functions

Classes

Interfaces

Enums

Type Aliases

Namespaces

Variables

variable ApolloConsumer

const ApolloConsumer: ReactTypes.FC<ApolloConsumerProps>;

    variable ApolloProvider

    const ApolloProvider: ReactTypes.FC<ApolloProviderProps<any>>;

      variable concat

      const concat: (
      first: ApolloLink | RequestHandler,
      second: ApolloLink | RequestHandler
      ) => ApolloLink;

        variable defaultPrinter

        const defaultPrinter: Printer;

          variable empty

          const empty: () => ApolloLink;

            variable execute

            const execute: (
            link: ApolloLink,
            operation: GraphQLRequest<Record<string, any>>
            ) => Observable<
            FetchResult<Record<string, any>, Record<string, any>, Record<string, any>>
            >;

              variable fallbackHttpConfig

              const fallbackHttpConfig: {
              http: HttpQueryOptions;
              headers: { accept: string; 'content-type': string };
              options: { method: string };
              };

                variable from

                const from: (links: (ApolloLink | RequestHandler)[]) => ApolloLink;

                  variable resetApolloContext

                  const resetApolloContext: () => ReactTypes.Context<ApolloContextValue>;
                  • Deprecated

                    This function has no "resetting" effect since Apollo Client 3.4.12, and will be removed in the next major version of Apollo Client. If you want to get the Apollo Context, use getApolloContext instead.

                  variable skipToken

                  const skipToken: Symbol;

                    variable split

                    const split: (
                    test: (op: Operation) => boolean,
                    left: ApolloLink | RequestHandler,
                    right?: ApolloLink | RequestHandler
                    ) => ApolloLink;

                      Functions

                      function checkFetcher

                      checkFetcher: (fetcher: typeof fetch | undefined) => void;
                        createHttpLink: (linkOptions?: HttpOptions) => ApolloLink;

                          function createQueryPreloader

                          createQueryPreloader: (client: ApolloClient<any>) => PreloadQueryFunction;
                          • A higher order function that returns a preloadQuery function which can be used to begin loading a query with the given client. This is useful when you want to start loading a query as early as possible outside of a React component.

                            > Refer to the [Suspense - Initiating queries outside React](https://www.apollographql.com/docs/react/data/suspense#initiating-queries-outside-react) section for a more in-depth overview.

                            Parameter client

                            The ApolloClient instance that will be used to load queries from the returned preloadQuery function.

                            Returns

                            The preloadQuery function.

                            Example 1

                            const preloadQuery = createQueryPreloader(client);

                            3.9.0

                            Modifiers

                            • @alpha

                          function createSignalIfSupported

                          createSignalIfSupported: () =>
                          | { controller: boolean; signal: boolean }
                          | { controller: AbortController; signal: AbortSignal };
                          • Deprecated

                            This is not used internally any more and will be removed in the next major version of Apollo Client.

                          function defaultDataIdFromObject

                          defaultDataIdFromObject: (
                          { __typename, id, _id }: Readonly<StoreObject>,
                          context?: KeyFieldsContext
                          ) => string | undefined;

                            function fromError

                            fromError: <T>(errorValue: any) => Observable<T>;

                              function fromPromise

                              fromPromise: <T>(promise: Promise<T>) => Observable<T>;

                                function getApolloContext

                                getApolloContext: () => ReactTypes.Context<ApolloContextValue>;

                                  function isApolloError

                                  isApolloError: (err: Error) => err is ApolloError;

                                    function isNetworkRequestSettled

                                    isNetworkRequestSettled: (networkStatus?: NetworkStatus) => boolean;
                                    • Returns true if the network request is in ready or error state according to a given network status.

                                    function isReference

                                    isReference: (obj: any) => obj is Reference;

                                      function makeReference

                                      makeReference: (id: string) => Reference;

                                        function makeVar

                                        makeVar: <T>(value: T) => ReactiveVar<T>;

                                          function mergeOptions

                                          mergeOptions: <
                                          TDefaultOptions extends Partial<OptionsUnion<any, any, any>>,
                                          TOptions extends TDefaultOptions
                                          >(
                                          defaults: TDefaultOptions | Partial<TDefaultOptions> | undefined,
                                          options: TOptions | Partial<TOptions>
                                          ) => TOptions & TDefaultOptions;

                                            function operationName

                                            operationName: (type: DocumentType) => string;

                                              function parseAndCheckHttpResponse

                                              parseAndCheckHttpResponse: (
                                              operations: Operation | Operation[]
                                              ) => (response: Response) => Promise<any>;

                                                function parser

                                                parser: typeof parser;

                                                  function rewriteURIForGET

                                                  rewriteURIForGET: (
                                                  chosenURI: string,
                                                  body: Body
                                                  ) =>
                                                  | { parseError: unknown; newURI?: undefined }
                                                  | { newURI: string; parseError?: undefined };

                                                    function selectHttpOptionsAndBody

                                                    selectHttpOptionsAndBody: (
                                                    operation: Operation,
                                                    fallbackConfig: HttpConfig,
                                                    ...configs: Array<HttpConfig>
                                                    ) => { options: HttpConfig & Record<string, any>; body: Body };

                                                      function selectHttpOptionsAndBodyInternal

                                                      selectHttpOptionsAndBodyInternal: (
                                                      operation: Operation,
                                                      printer: Printer,
                                                      ...configs: HttpConfig[]
                                                      ) => { options: HttpConfig & Record<string, any>; body: Body };

                                                        function selectURI

                                                        selectURI: (
                                                        operation: Operation,
                                                        fallbackURI?: string | ((operation: Operation) => string)
                                                        ) => any;

                                                          function serializeFetchParameter

                                                          serializeFetchParameter: (p: any, label: string) => string;

                                                            function throwServerError

                                                            throwServerError: (response: Response, result: any, message: string) => never;

                                                              function toPromise

                                                              toPromise: <R>(observable: Observable<R>) => Promise<R>;

                                                                function useApolloClient

                                                                useApolloClient: (override?: ApolloClient<object>) => ApolloClient<object>;
                                                                • Returns

                                                                  The ApolloClient instance being used by the application.

                                                                  Example 1

                                                                  import { useApolloClient } from '@apollo/client';
                                                                  function SomeComponent() {
                                                                  const client = useApolloClient();
                                                                  // `client` is now set to the `ApolloClient` instance being used by the
                                                                  // application (that was configured using something like `ApolloProvider`)
                                                                  }

                                                                  3.0.0

                                                                function useBackgroundQuery

                                                                useBackgroundQuery: {
                                                                <
                                                                TData,
                                                                TVariables extends OperationVariables,
                                                                TOptions extends Omit<
                                                                BackgroundQueryHookOptions<TData, OperationVariables>,
                                                                'variables'
                                                                >
                                                                >(
                                                                query: DocumentNode | TypedDocumentNode<TData, TVariables>,
                                                                options?: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & TOptions
                                                                ): [
                                                                (
                                                                | QueryReference<
                                                                TOptions['errorPolicy'] extends 'ignore' | 'all'
                                                                ? TOptions['returnPartialData'] extends true
                                                                ? DeepPartial<TData> | undefined
                                                                : TData | undefined
                                                                : TOptions['returnPartialData'] extends true
                                                                ? DeepPartial<TData>
                                                                : TData,
                                                                TVariables
                                                                >
                                                                | (TOptions['skip'] extends boolean ? undefined : never)
                                                                ),
                                                                UseBackgroundQueryResult<TData, TVariables>
                                                                ];
                                                                <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                query: any,
                                                                options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
                                                                returnPartialData: true;
                                                                errorPolicy: 'all' | 'ignore';
                                                                }
                                                                ): [
                                                                QueryReference<DeepPartial<TData>, TVariables>,
                                                                UseBackgroundQueryResult<TData, TVariables>
                                                                ];
                                                                <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                query: any,
                                                                options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
                                                                errorPolicy: 'all' | 'ignore';
                                                                }
                                                                ): [
                                                                QueryReference<TData, TVariables>,
                                                                UseBackgroundQueryResult<TData, TVariables>
                                                                ];
                                                                <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                query: any,
                                                                options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
                                                                skip: boolean;
                                                                returnPartialData: true;
                                                                }
                                                                ): [
                                                                QueryReference<DeepPartial<TData>, TVariables>,
                                                                UseBackgroundQueryResult<TData, TVariables>
                                                                ];
                                                                <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                query: any,
                                                                options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
                                                                returnPartialData: true;
                                                                }
                                                                ): [
                                                                QueryReference<DeepPartial<TData>, TVariables>,
                                                                UseBackgroundQueryResult<TData, TVariables>
                                                                ];
                                                                <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                query: any,
                                                                options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
                                                                skip: boolean;
                                                                }
                                                                ): [
                                                                QueryReference<TData, TVariables>,
                                                                UseBackgroundQueryResult<TData, TVariables>
                                                                ];
                                                                <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                query: any,
                                                                options?: BackgroundQueryHookOptionsNoInfer<TData, TVariables>
                                                                ): [
                                                                QueryReference<TData, TVariables>,
                                                                UseBackgroundQueryResult<TData, TVariables>
                                                                ];
                                                                <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                query: any,
                                                                options: typeof skipToken
                                                                ): [undefined, UseBackgroundQueryResult<TData, TVariables>];
                                                                <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                query: any,
                                                                options:
                                                                | typeof skipToken
                                                                | (BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
                                                                returnPartialData: true;
                                                                })
                                                                ): [
                                                                QueryReference<DeepPartial<TData>, TVariables>,
                                                                UseBackgroundQueryResult<TData, TVariables>
                                                                ];
                                                                <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                query: any,
                                                                options?:
                                                                | typeof skipToken
                                                                | BackgroundQueryHookOptionsNoInfer<TData, TVariables>
                                                                ): [
                                                                QueryReference<TData, TVariables>,
                                                                UseBackgroundQueryResult<TData, TVariables>
                                                                ];
                                                                };

                                                                  function useFragment

                                                                  useFragment: <TData = any, TVars = OperationVariables>(
                                                                  options: UseFragmentOptions<TData, TVars>
                                                                  ) => UseFragmentResult<TData>;

                                                                    function useLazyQuery

                                                                    useLazyQuery: <
                                                                    TData = any,
                                                                    TVariables extends OperationVariables = OperationVariables
                                                                    >(
                                                                    query: DocumentNode | TypedDocumentNode<TData, TVariables>,
                                                                    options?: LazyQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>
                                                                    ) => LazyQueryResultTuple<TData, TVariables>;
                                                                    • 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.

                                                                      Parameter query

                                                                      A GraphQL query document parsed into an AST by gql.

                                                                      Parameter options

                                                                      Default options to control how the query is executed.

                                                                      Returns

                                                                      A tuple in the form of [execute, result]

                                                                      Example 1

                                                                      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 <p>Loading ...</p>
                                                                      if (!called) {
                                                                      return <button onClick={() => loadGreeting()}>Load greeting</button>
                                                                      }
                                                                      return <h1>Hello {data.greeting.message}!</h1>;
                                                                      }

                                                                      3.0.0

                                                                    function useLoadableQuery

                                                                    useLoadableQuery: {
                                                                    <
                                                                    TData,
                                                                    TVariables extends OperationVariables,
                                                                    TOptions extends LoadableQueryHookOptions
                                                                    >(
                                                                    query: DocumentNode | TypedDocumentNode<TData, TVariables>,
                                                                    options?: LoadableQueryHookOptions & TOptions
                                                                    ): UseLoadableQueryResult<
                                                                    TOptions['errorPolicy'] extends 'all' | 'ignore'
                                                                    ? TOptions['returnPartialData'] extends true
                                                                    ? DeepPartial<TData>
                                                                    : TData
                                                                    : TOptions['returnPartialData'] extends true
                                                                    ? DeepPartial<TData>
                                                                    : TData,
                                                                    TVariables
                                                                    >;
                                                                    <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                    query: any,
                                                                    options: LoadableQueryHookOptions & {
                                                                    returnPartialData: true;
                                                                    errorPolicy: 'all' | 'ignore';
                                                                    }
                                                                    ): UseLoadableQueryResult<DeepPartial<TData>, TVariables>;
                                                                    <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                    query: any,
                                                                    options: LoadableQueryHookOptions & { errorPolicy: 'all' | 'ignore' }
                                                                    ): UseLoadableQueryResult<TData, TVariables>;
                                                                    <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                    query: any,
                                                                    options: LoadableQueryHookOptions & { returnPartialData: true }
                                                                    ): UseLoadableQueryResult<DeepPartial<TData>, TVariables>;
                                                                    <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                    query: any,
                                                                    options?: LoadableQueryHookOptions
                                                                    ): UseLoadableQueryResult<TData, TVariables>;
                                                                    };
                                                                    • A hook for imperatively loading a query, such as responding to a user interaction.

                                                                      > Refer to the [Suspense - Fetching in response to user interaction](https://www.apollographql.com/docs/react/data/suspense#fetching-in-response-to-user-interaction) section for a more in-depth overview of useLoadableQuery.

                                                                      Parameter query

                                                                      A GraphQL query document parsed into an AST by gql.

                                                                      Parameter options

                                                                      Options to control how the query is executed.

                                                                      Returns

                                                                      A tuple in the form of [loadQuery, queryRef, handlers]

                                                                      Example 1

                                                                      import { gql, useLoadableQuery } from "@apollo/client";
                                                                      const GET_GREETING = gql`
                                                                      query GetGreeting($language: String!) {
                                                                      greeting(language: $language) {
                                                                      message
                                                                      }
                                                                      }
                                                                      `;
                                                                      function App() {
                                                                      const [loadGreeting, queryRef] = useLoadableQuery(GET_GREETING);
                                                                      return (
                                                                      <>
                                                                      <button onClick={() => loadGreeting({ language: "english" })}>
                                                                      Load greeting
                                                                      </button>
                                                                      <Suspense fallback={<div>Loading...</div>}>
                                                                      {queryRef && <Hello queryRef={queryRef} />}
                                                                      </Suspense>
                                                                      </>
                                                                      );
                                                                      }
                                                                      function Hello({ queryRef }) {
                                                                      const { data } = useReadQuery(queryRef);
                                                                      return <div>{data.greeting.message}</div>;
                                                                      }

                                                                      3.9.0

                                                                    function useMutation

                                                                    useMutation: <
                                                                    TData = any,
                                                                    TVariables = OperationVariables,
                                                                    TContext = DefaultContext,
                                                                    TCache extends ApolloCache<any> = ApolloCache<any>
                                                                    >(
                                                                    mutation: DocumentNode | TypedDocumentNode<TData, TVariables>,
                                                                    options?: MutationHookOptions<
                                                                    NoInfer<TData>,
                                                                    NoInfer<TVariables>,
                                                                    TContext,
                                                                    TCache
                                                                    >
                                                                    ) => MutationTuple<TData, TVariables, TContext, TCache>;
                                                                    • > Refer to the [Mutations](https://www.apollographql.com/docs/react/data/mutations/) section for a more in-depth overview of useMutation.

                                                                      Parameter mutation

                                                                      A GraphQL mutation document parsed into an AST by gql.

                                                                      Parameter options

                                                                      Options to control how the mutation is executed.

                                                                      Returns

                                                                      A tuple in the form of [mutate, result]

                                                                      Example 1

                                                                      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 (
                                                                      <div>
                                                                      <form
                                                                      onSubmit={e => {
                                                                      e.preventDefault();
                                                                      addTodo({ variables: { type: input.value } });
                                                                      input.value = '';
                                                                      }}
                                                                      >
                                                                      <input
                                                                      ref={node => {
                                                                      input = node;
                                                                      }}
                                                                      />
                                                                      <button type="submit">Add Todo</button>
                                                                      </form>
                                                                      </div>
                                                                      );
                                                                      }

                                                                      3.0.0

                                                                    function useQuery

                                                                    useQuery: <
                                                                    TData = any,
                                                                    TVariables extends OperationVariables = OperationVariables
                                                                    >(
                                                                    query: DocumentNode | TypedDocumentNode<TData, TVariables>,
                                                                    options?: QueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>
                                                                    ) => QueryResult<TData, TVariables>;
                                                                    • A hook for executing queries in an Apollo application.

                                                                      To run a query within a React component, call useQuery and pass it a GraphQL query document.

                                                                      When your component renders, useQuery returns an object from Apollo Client that contains loading, error, and data properties you can use to render your UI.

                                                                      > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of useQuery.

                                                                      Parameter query

                                                                      A GraphQL query document parsed into an AST by gql.

                                                                      Parameter options

                                                                      Options to control how the query is executed.

                                                                      Returns

                                                                      Query result object

                                                                      Example 1

                                                                      import { gql, useQuery } from '@apollo/client';
                                                                      const GET_GREETING = gql`
                                                                      query GetGreeting($language: String!) {
                                                                      greeting(language: $language) {
                                                                      message
                                                                      }
                                                                      }
                                                                      `;
                                                                      function Hello() {
                                                                      const { loading, error, data } = useQuery(GET_GREETING, {
                                                                      variables: { language: 'english' },
                                                                      });
                                                                      if (loading) return <p>Loading ...</p>;
                                                                      return <h1>Hello {data.greeting.message}!</h1>;
                                                                      }

                                                                      3.0.0

                                                                    function useQueryRefHandlers

                                                                    useQueryRefHandlers: <
                                                                    TData = unknown,
                                                                    TVariables extends OperationVariables = OperationVariables
                                                                    >(
                                                                    queryRef: QueryReference<TData, TVariables>
                                                                    ) => UseQueryRefHandlersResult<TData, TVariables>;
                                                                    • A React hook that returns a refetch and fetchMore function for a given queryRef.

                                                                      This is useful to get access to handlers for a queryRef that was created by createQueryPreloader or when the handlers for a queryRef produced in a different component are inaccessible.

                                                                      Parameter queryRef

                                                                      A QueryReference returned from useBackgroundQuery, useLoadableQuery, or createQueryPreloader.

                                                                      Example 1

                                                                      const MyComponent({ queryRef }) {
                                                                      const { refetch, fetchMore } = useQueryRefHandlers(queryRef);
                                                                      // ...
                                                                      }

                                                                      3.9.0

                                                                    function useReactiveVar

                                                                    useReactiveVar: <T>(rv: ReactiveVar<T>) => T;
                                                                    • Reads the value of a [reactive variable](https://www.apollographql.com/docs/react/local-state/reactive-variables/) and re-renders the containing component whenever that variable's value changes. This enables a reactive variable to trigger changes _without_ relying on the useQuery hook.

                                                                      Parameter rv

                                                                      A reactive variable.

                                                                      Returns

                                                                      The current value of the reactive variable.

                                                                      Example 1

                                                                      import { makeVar, useReactiveVar } from "@apollo/client";
                                                                      export const cartItemsVar = makeVar([]);
                                                                      export function Cart() {
                                                                      const cartItems = useReactiveVar(cartItemsVar);
                                                                      // ...
                                                                      }

                                                                      3.2.0

                                                                    function useReadQuery

                                                                    useReadQuery: <TData>(
                                                                    queryRef: QueryReference<TData>
                                                                    ) => UseReadQueryResult<TData>;

                                                                      function useSubscription

                                                                      useSubscription: <
                                                                      TData = any,
                                                                      TVariables extends OperationVariables = OperationVariables
                                                                      >(
                                                                      subscription: DocumentNode | TypedDocumentNode<TData, TVariables>,
                                                                      options?: SubscriptionHookOptions<NoInfer<TData>, NoInfer<TVariables>>
                                                                      ) => SubscriptionResult<TData, TVariables>;
                                                                      • > Refer to the [Subscriptions](https://www.apollographql.com/docs/react/data/subscriptions/) section for a more in-depth overview of useSubscription.

                                                                        Parameter subscription

                                                                        A GraphQL subscription document parsed into an AST by gql.

                                                                        Parameter options

                                                                        Options to control how the subscription is executed.

                                                                        Returns

                                                                        Query result object

                                                                        Remarks

                                                                        #### Subscriptions and React 18 Automatic Batching

                                                                        With React 18's [automatic batching](https://react.dev/blog/2022/03/29/react-v18#new-feature-automatic-batching), multiple state updates may be grouped into a single re-render for better performance.

                                                                        If your subscription API sends multiple messages at the same time or in very fast succession (within fractions of a millisecond), it is likely that only the last message received in that narrow time frame will result in a re-render.

                                                                        Consider the following component:

                                                                        export function Subscriptions() {
                                                                        const { data, error, loading } = useSubscription(query);
                                                                        const [accumulatedData, setAccumulatedData] = useState([]);
                                                                        useEffect(() => {
                                                                        setAccumulatedData((prev) => [...prev, data]);
                                                                        }, [data]);
                                                                        return (
                                                                        <>
                                                                        {loading && <p>Loading...</p>}
                                                                        {JSON.stringify(accumulatedData, undefined, 2)}
                                                                        </>
                                                                        );
                                                                        }

                                                                        If your subscription back-end emits two messages with the same timestamp, only the last message received by Apollo Client will be rendered. This is because React 18 will batch these two state updates into a single re-render.

                                                                        Since the component above is using useEffect to push data into a piece of local state on each Subscriptions re-render, the first message will never be added to the accumulatedData array since its render was skipped.

                                                                        Instead of using useEffect here, we can re-write this component to use the onData callback function accepted in useSubscription's options object:

                                                                        export function Subscriptions() {
                                                                        const [accumulatedData, setAccumulatedData] = useState([]);
                                                                        const { data, error, loading } = useSubscription(
                                                                        query,
                                                                        {
                                                                        onData({ data }) {
                                                                        setAccumulatedData((prev) => [...prev, data])
                                                                        }
                                                                        }
                                                                        );
                                                                        return (
                                                                        <>
                                                                        {loading && <p>Loading...</p>}
                                                                        {JSON.stringify(accumulatedData, undefined, 2)}
                                                                        </>
                                                                        );
                                                                        }

                                                                        > ⚠️ **Note:** The useSubscription option onData is available in Apollo Client >= 3.7. In previous versions, the equivalent option is named onSubscriptionData.

                                                                        Now, the first message will be added to the accumulatedData array since onData is called _before_ the component re-renders. React 18 automatic batching is still in effect and results in a single re-render, but with onData we can guarantee each message received after the component mounts is added to accumulatedData.

                                                                        3.0.0

                                                                        Example 1

                                                                        const COMMENTS_SUBSCRIPTION = gql`
                                                                        subscription OnCommentAdded($repoFullName: String!) {
                                                                        commentAdded(repoFullName: $repoFullName) {
                                                                        id
                                                                        content
                                                                        }
                                                                        }
                                                                        `;
                                                                        function DontReadTheComments({ repoFullName }) {
                                                                        const {
                                                                        data: { commentAdded },
                                                                        loading,
                                                                        } = useSubscription(COMMENTS_SUBSCRIPTION, { variables: { repoFullName } });
                                                                        return <h4>New comment: {!loading && commentAdded.content}</h4>;
                                                                        }

                                                                      function useSuspenseQuery

                                                                      useSuspenseQuery: {
                                                                      <
                                                                      TData,
                                                                      TVariables extends OperationVariables,
                                                                      TOptions extends Omit<
                                                                      SuspenseQueryHookOptions<TData, OperationVariables>,
                                                                      'variables'
                                                                      >
                                                                      >(
                                                                      query: DocumentNode | TypedDocumentNode<TData, TVariables>,
                                                                      options?: SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> &
                                                                      TOptions
                                                                      ): UseSuspenseQueryResult<
                                                                      TOptions['errorPolicy'] extends 'ignore' | 'all'
                                                                      ? TOptions['returnPartialData'] extends true
                                                                      ? DeepPartial<TData> | undefined
                                                                      : TData | undefined
                                                                      : TOptions['returnPartialData'] extends true
                                                                      ? TOptions['skip'] extends boolean
                                                                      ? DeepPartial<TData> | undefined
                                                                      : DeepPartial<TData>
                                                                      : TOptions['skip'] extends boolean
                                                                      ? TData | undefined
                                                                      : TData,
                                                                      TVariables
                                                                      >;
                                                                      <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                      query: any,
                                                                      options: SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> & {
                                                                      returnPartialData: true;
                                                                      errorPolicy: 'all' | 'ignore';
                                                                      }
                                                                      ): UseSuspenseQueryResult<DeepPartial<TData>, TVariables>;
                                                                      <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                      query: any,
                                                                      options: SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> & {
                                                                      errorPolicy: 'all' | 'ignore';
                                                                      }
                                                                      ): UseSuspenseQueryResult<TData, TVariables>;
                                                                      <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                      query: any,
                                                                      options: SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> & {
                                                                      skip: boolean;
                                                                      returnPartialData: true;
                                                                      }
                                                                      ): UseSuspenseQueryResult<DeepPartial<TData>, TVariables>;
                                                                      <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                      query: any,
                                                                      options: SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> & {
                                                                      returnPartialData: true;
                                                                      }
                                                                      ): UseSuspenseQueryResult<DeepPartial<TData>, TVariables>;
                                                                      <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                      query: any,
                                                                      options: SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> & {
                                                                      skip: boolean;
                                                                      }
                                                                      ): UseSuspenseQueryResult<TData, TVariables>;
                                                                      <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                      query: any,
                                                                      options?: SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>
                                                                      ): UseSuspenseQueryResult<TData, TVariables>;
                                                                      <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                      query: any,
                                                                      options:
                                                                      | typeof skipToken
                                                                      | (SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> & {
                                                                      returnPartialData: true;
                                                                      })
                                                                      ): UseSuspenseQueryResult<DeepPartial<TData>, TVariables>;
                                                                      <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
                                                                      query: any,
                                                                      options?:
                                                                      | typeof skipToken
                                                                      | SuspenseQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>
                                                                      ): UseSuspenseQueryResult<TData, TVariables>;
                                                                      };

                                                                        Classes

                                                                        class ApolloCache

                                                                        abstract class ApolloCache<TSerialized> implements DataProxy {}

                                                                          property assumeImmutableResults

                                                                          readonly assumeImmutableResults: boolean;

                                                                            method batch

                                                                            batch: <U>(options: Cache.BatchOptions<this, U>) => U;

                                                                              method diff

                                                                              abstract diff: <T>(query: Cache.DiffOptions) => Cache.DiffResult<T>;

                                                                                method evict

                                                                                abstract evict: (options: Cache.EvictOptions) => boolean;

                                                                                  method extract

                                                                                  abstract extract: (optimistic?: boolean) => TSerialized;
                                                                                  • Exposes the cache's complete state, in a serializable format for later restoration.

                                                                                  method gc

                                                                                  gc: () => string[];

                                                                                    method identify

                                                                                    identify: (object: StoreObject | Reference) => string | undefined;

                                                                                      method modify

                                                                                      modify: <Entity extends Record<string, any> = Record<string, any>>(
                                                                                      options: Cache.ModifyOptions<Entity>
                                                                                      ) => boolean;

                                                                                        method performTransaction

                                                                                        abstract performTransaction: (
                                                                                        transaction: Transaction<TSerialized>,
                                                                                        optimisticId?: string | null
                                                                                        ) => void;

                                                                                          method read

                                                                                          abstract read: <TData = any, TVariables = any>(
                                                                                          query: Cache.ReadOptions<TVariables, TData>
                                                                                          ) => TData | null;

                                                                                            method readFragment

                                                                                            readFragment: <FragmentType, TVariables = any>(
                                                                                            options: Cache.ReadFragmentOptions<FragmentType, TVariables>,
                                                                                            optimistic?: boolean
                                                                                            ) => FragmentType | null;

                                                                                              method readQuery

                                                                                              readQuery: <QueryType, TVariables = any>(
                                                                                              options: Cache.ReadQueryOptions<QueryType, TVariables>,
                                                                                              optimistic?: boolean
                                                                                              ) => QueryType | null;

                                                                                                method recordOptimisticTransaction

                                                                                                recordOptimisticTransaction: (
                                                                                                transaction: Transaction<TSerialized>,
                                                                                                optimisticId: string
                                                                                                ) => void;

                                                                                                  method removeOptimistic

                                                                                                  abstract removeOptimistic: (id: string) => void;

                                                                                                    method reset

                                                                                                    abstract reset: (options?: Cache.ResetOptions) => Promise<void>;

                                                                                                      method restore

                                                                                                      abstract restore: (serializedState: TSerialized) => ApolloCache<TSerialized>;
                                                                                                      • Replaces existing state in the cache (if any) with the values expressed by serializedState.

                                                                                                        Called when hydrating a cache (server side rendering, or offline storage), and also (potentially) during hot reloads.

                                                                                                      method transformDocument

                                                                                                      transformDocument: (document: DocumentNode) => DocumentNode;
                                                                                                        transformForLink: (document: DocumentNode) => DocumentNode;

                                                                                                          method updateFragment

                                                                                                          updateFragment: <TData = any, TVariables = any>(
                                                                                                          options: Cache.UpdateFragmentOptions<TData, TVariables>,
                                                                                                          update: (data: TData | null) => TData | null | void
                                                                                                          ) => TData | null;

                                                                                                            method updateQuery

                                                                                                            updateQuery: <TData = any, TVariables = any>(
                                                                                                            options: Cache.UpdateQueryOptions<TData, TVariables>,
                                                                                                            update: (data: TData | null) => TData | null | void
                                                                                                            ) => TData | null;

                                                                                                              method watch

                                                                                                              abstract watch: <TData = any, TVariables = any>(
                                                                                                              watch: Cache.WatchOptions<TData, TVariables>
                                                                                                              ) => () => void;

                                                                                                                method write

                                                                                                                abstract write: <TData = any, TVariables = any>(
                                                                                                                write: Cache.WriteOptions<TData, TVariables>
                                                                                                                ) => Reference | undefined;

                                                                                                                  method writeFragment

                                                                                                                  writeFragment: <TData = any, TVariables = any>({
                                                                                                                  id,
                                                                                                                  data,
                                                                                                                  fragment,
                                                                                                                  fragmentName,
                                                                                                                  ...options
                                                                                                                  }: Cache.WriteFragmentOptions<TData, TVariables>) => Reference | undefined;

                                                                                                                    method writeQuery

                                                                                                                    writeQuery: <TData = any, TVariables = any>({
                                                                                                                    id,
                                                                                                                    data,
                                                                                                                    ...options
                                                                                                                    }: Cache.WriteQueryOptions<TData, TVariables>) => Reference | undefined;

                                                                                                                      class ApolloClient

                                                                                                                      class ApolloClient<TCacheShape> implements DataProxy {}
                                                                                                                      • This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries and mutations) to a GraphQL spec-compliant server over an ApolloLink instance, receive results from the server and cache the results in a store. It also delivers updates to GraphQL queries through Observable instances.

                                                                                                                      constructor

                                                                                                                      constructor(options: ApolloClientOptions<TCacheShape>);
                                                                                                                      • Constructs an instance of ApolloClient.

                                                                                                                        Example 1

                                                                                                                        import { ApolloClient, InMemoryCache } from '@apollo/client';
                                                                                                                        const cache = new InMemoryCache();
                                                                                                                        const client = new ApolloClient({
                                                                                                                        // Provide required constructor fields
                                                                                                                        cache: cache,
                                                                                                                        uri: 'http://localhost:4000/',
                                                                                                                        // Provide some optional constructor fields
                                                                                                                        name: 'react-web-client',
                                                                                                                        version: '1.3',
                                                                                                                        queryDeduplication: false,
                                                                                                                        defaultOptions: {
                                                                                                                        watchQuery: {
                                                                                                                        fetchPolicy: 'cache-and-network',
                                                                                                                        },
                                                                                                                        },
                                                                                                                        });

                                                                                                                      property cache

                                                                                                                      cache: ApolloCache<TCacheShape>;

                                                                                                                        property defaultContext

                                                                                                                        readonly defaultContext: Partial<DefaultContext>;

                                                                                                                          property defaultOptions

                                                                                                                          defaultOptions: DefaultOptions;

                                                                                                                            property disableNetworkFetches

                                                                                                                            disableNetworkFetches: boolean;

                                                                                                                              property documentTransform

                                                                                                                              readonly documentTransform: DocumentTransform;
                                                                                                                              • The DocumentTransform used to modify GraphQL documents before a request is made. If a custom DocumentTransform is not provided, this will be the default document transform.

                                                                                                                              property getMemoryInternals

                                                                                                                              getMemoryInternals?: () => {
                                                                                                                              limits: { [k: string]: number };
                                                                                                                              sizes: {
                                                                                                                              cache?: { fragmentQueryDocuments: number };
                                                                                                                              addTypenameDocumentTransform?: { cache: number }[];
                                                                                                                              inMemoryCache?: {
                                                                                                                              executeSelectionSet: number;
                                                                                                                              executeSubSelectedArray: number;
                                                                                                                              maybeBroadcastWatch: number;
                                                                                                                              };
                                                                                                                              fragmentRegistry?: {
                                                                                                                              findFragmentSpreads: number;
                                                                                                                              lookup: number;
                                                                                                                              transform: number;
                                                                                                                              };
                                                                                                                              print: number;
                                                                                                                              parser: number;
                                                                                                                              canonicalStringify: number;
                                                                                                                              links: unknown[];
                                                                                                                              queryManager: {
                                                                                                                              getDocumentInfo: number;
                                                                                                                              documentTransforms: { cache: number }[];
                                                                                                                              };
                                                                                                                              };
                                                                                                                              };
                                                                                                                              • This is not a stable API - it is used in development builds to expose information to the DevTools. Use at your own risk! For more details, see [Memory Management](https://www.apollographql.com/docs/react/caching/memory-management/#measuring-cache-usage)

                                                                                                                                Example 1

                                                                                                                                console.log(client.getMemoryInternals())

                                                                                                                                Logs output in the following JSON format:

                                                                                                                                Example 2

                                                                                                                                {
                                                                                                                                limits: {
                                                                                                                                parser: 1000,
                                                                                                                                canonicalStringify: 1000,
                                                                                                                                print: 2000,
                                                                                                                                'documentTransform.cache': 2000,
                                                                                                                                'queryManager.getDocumentInfo': 2000,
                                                                                                                                'PersistedQueryLink.persistedQueryHashes': 2000,
                                                                                                                                'fragmentRegistry.transform': 2000,
                                                                                                                                'fragmentRegistry.lookup': 1000,
                                                                                                                                'fragmentRegistry.findFragmentSpreads': 4000,
                                                                                                                                'cache.fragmentQueryDocuments': 1000,
                                                                                                                                'removeTypenameFromVariables.getVariableDefinitions': 2000,
                                                                                                                                'inMemoryCache.maybeBroadcastWatch': 5000,
                                                                                                                                'inMemoryCache.executeSelectionSet': 10000,
                                                                                                                                'inMemoryCache.executeSubSelectedArray': 5000
                                                                                                                                },
                                                                                                                                sizes: {
                                                                                                                                parser: 26,
                                                                                                                                canonicalStringify: 4,
                                                                                                                                print: 14,
                                                                                                                                addTypenameDocumentTransform: [
                                                                                                                                {
                                                                                                                                cache: 14,
                                                                                                                                },
                                                                                                                                ],
                                                                                                                                queryManager: {
                                                                                                                                getDocumentInfo: 14,
                                                                                                                                documentTransforms: [
                                                                                                                                {
                                                                                                                                cache: 14,
                                                                                                                                },
                                                                                                                                {
                                                                                                                                cache: 14,
                                                                                                                                },
                                                                                                                                ],
                                                                                                                                },
                                                                                                                                fragmentRegistry: {
                                                                                                                                findFragmentSpreads: 34,
                                                                                                                                lookup: 20,
                                                                                                                                transform: 14,
                                                                                                                                },
                                                                                                                                cache: {
                                                                                                                                fragmentQueryDocuments: 22,
                                                                                                                                },
                                                                                                                                inMemoryCache: {
                                                                                                                                executeSelectionSet: 4345,
                                                                                                                                executeSubSelectedArray: 1206,
                                                                                                                                maybeBroadcastWatch: 32,
                                                                                                                                },
                                                                                                                                links: [
                                                                                                                                {
                                                                                                                                PersistedQueryLink: {
                                                                                                                                persistedQueryHashes: 14,
                                                                                                                                },
                                                                                                                                },
                                                                                                                                {
                                                                                                                                removeTypenameFromVariables: {
                                                                                                                                getVariableDefinitions: 14,
                                                                                                                                },
                                                                                                                                },
                                                                                                                                ],
                                                                                                                                },
                                                                                                                                }

                                                                                                                                Modifiers

                                                                                                                                • @experimental
                                                                                                                              link: ApolloLink;

                                                                                                                                property queryDeduplication

                                                                                                                                queryDeduplication: boolean;

                                                                                                                                  property typeDefs

                                                                                                                                  readonly typeDefs: any;

                                                                                                                                    property version

                                                                                                                                    version: string;

                                                                                                                                      method addResolvers

                                                                                                                                      addResolvers: (resolvers: Resolvers | Resolvers[]) => void;
                                                                                                                                      • Add additional local resolvers.

                                                                                                                                      method clearStore

                                                                                                                                      clearStore: () => Promise<any[]>;
                                                                                                                                      • Remove all data from the store. Unlike resetStore, clearStore will not refetch any active queries.

                                                                                                                                      method extract

                                                                                                                                      extract: (optimistic?: boolean) => TCacheShape;
                                                                                                                                      • Exposes the cache's complete state, in a serializable format for later restoration.

                                                                                                                                      method getObservableQueries

                                                                                                                                      getObservableQueries: (
                                                                                                                                      include?: RefetchQueriesInclude
                                                                                                                                      ) => Map<string, ObservableQuery<any>>;
                                                                                                                                      • Get all currently active ObservableQuery objects, in a Map keyed by query ID strings.

                                                                                                                                        An "active" query is one that has observers and a fetchPolicy other than "standby" or "cache-only".

                                                                                                                                        You can include all ObservableQuery objects (including the inactive ones) by passing "all" instead of "active", or you can include just a subset of active queries by passing an array of query names or DocumentNode objects.

                                                                                                                                      method getResolvers

                                                                                                                                      getResolvers: () => Resolvers;
                                                                                                                                      • Get all registered local resolvers.

                                                                                                                                      method mutate

                                                                                                                                      mutate: <
                                                                                                                                      TData = any,
                                                                                                                                      TVariables extends OperationVariables = OperationVariables,
                                                                                                                                      TContext extends Record<string, any> = DefaultContext,
                                                                                                                                      TCache extends ApolloCache<any> = ApolloCache<any>
                                                                                                                                      >(
                                                                                                                                      options: MutationOptions<TData, TVariables, TContext>
                                                                                                                                      ) => Promise<FetchResult<TData>>;
                                                                                                                                      • This resolves a single mutation according to the options specified and returns a Promise which is either resolved with the resulting data or rejected with an error. In some cases both data and errors might be undefined, for example when errorPolicy is set to 'ignore'.

                                                                                                                                        It takes options as an object with the following keys and values:

                                                                                                                                      method onClearStore

                                                                                                                                      onClearStore: (cb: () => Promise<any>) => () => void;
                                                                                                                                      • Allows callbacks to be registered that are executed when the store is cleared. onClearStore returns an unsubscribe function that can be used to remove registered callbacks.

                                                                                                                                      method onResetStore

                                                                                                                                      onResetStore: (cb: () => Promise<any>) => () => void;
                                                                                                                                      • Allows callbacks to be registered that are executed when the store is reset. onResetStore returns an unsubscribe function that can be used to remove registered callbacks.

                                                                                                                                      method query

                                                                                                                                      query: <T = any, TVariables extends OperationVariables = OperationVariables>(
                                                                                                                                      options: QueryOptions<TVariables, T>
                                                                                                                                      ) => Promise<ApolloQueryResult<T>>;
                                                                                                                                      • This resolves a single query according to the options specified and returns a Promise which is either resolved with the resulting data or rejected with an error.

                                                                                                                                        Parameter options

                                                                                                                                        An object of type QueryOptions that allows us to describe how this query should be treated e.g. whether it should hit the server at all or just resolve from the cache, etc.

                                                                                                                                      method readFragment

                                                                                                                                      readFragment: <T = any, TVariables = OperationVariables>(
                                                                                                                                      options: DataProxy.Fragment<TVariables, T>,
                                                                                                                                      optimistic?: boolean
                                                                                                                                      ) => T | null;
                                                                                                                                      • Tries to read some data from the store in the shape of the provided GraphQL fragment without making a network request. This method will read a GraphQL fragment from any arbitrary id that is currently cached, unlike readQuery which will only read from the root query.

                                                                                                                                        You must pass in a GraphQL document with a single fragment or a document with multiple fragments that represent what you are reading. If you pass in a document with multiple fragments then you must also specify a fragmentName.

                                                                                                                                        Parameter optimistic

                                                                                                                                        Set to true to allow readFragment to return optimistic results. Is false by default.

                                                                                                                                      method readQuery

                                                                                                                                      readQuery: <T = any, TVariables = OperationVariables>(
                                                                                                                                      options: DataProxy.Query<TVariables, T>,
                                                                                                                                      optimistic?: boolean
                                                                                                                                      ) => T | null;
                                                                                                                                      • Tries to read some data from the store in the shape of the provided GraphQL query without making a network request. This method will start at the root query. To start at a specific id returned by dataIdFromObject use readFragment.

                                                                                                                                        Parameter optimistic

                                                                                                                                        Set to true to allow readQuery to return optimistic results. Is false by default.

                                                                                                                                      method reFetchObservableQueries

                                                                                                                                      reFetchObservableQueries: (
                                                                                                                                      includeStandby?: boolean
                                                                                                                                      ) => Promise<ApolloQueryResult<any>[]>;
                                                                                                                                      • Refetches all of your active queries.

                                                                                                                                        reFetchObservableQueries() is useful if you want to bring the client back to proper state in case of a network outage

                                                                                                                                        It is important to remember that reFetchObservableQueries() *will* refetch any active queries. This means that any components that might be mounted will execute their queries again using your network interface. If you do not want to re-execute any queries then you should make sure to stop watching any active queries. Takes optional parameter includeStandby which will include queries in standby-mode when refetching.

                                                                                                                                      method refetchQueries

                                                                                                                                      refetchQueries: <
                                                                                                                                      TCache extends ApolloCache<any> = ApolloCache<TCacheShape>,
                                                                                                                                      TResult = Promise<ApolloQueryResult<any>>
                                                                                                                                      >(
                                                                                                                                      options: RefetchQueriesOptions<TCache, TResult>
                                                                                                                                      ) => RefetchQueriesResult<TResult>;
                                                                                                                                      • Refetches specified active queries. Similar to "reFetchObservableQueries()" but with a specific list of queries.

                                                                                                                                        refetchQueries() is useful for use cases to imperatively refresh a selection of queries.

                                                                                                                                        It is important to remember that refetchQueries() *will* refetch specified active queries. This means that any components that might be mounted will execute their queries again using your network interface. If you do not want to re-execute any queries then you should make sure to stop watching any active queries.

                                                                                                                                      method resetStore

                                                                                                                                      resetStore: () => Promise<ApolloQueryResult<any>[] | null>;
                                                                                                                                      • Resets your entire store by clearing out your cache and then re-executing all of your active queries. This makes it so that you may guarantee that there is no data left in your store from a time before you called this method.

                                                                                                                                        resetStore() is useful when your user just logged out. You’ve removed the user session, and you now want to make sure that any references to data you might have fetched while the user session was active is gone.

                                                                                                                                        It is important to remember that resetStore() *will* refetch any active queries. This means that any components that might be mounted will execute their queries again using your network interface. If you do not want to re-execute any queries then you should make sure to stop watching any active queries.

                                                                                                                                      method restore

                                                                                                                                      restore: (serializedState: TCacheShape) => ApolloCache<TCacheShape>;
                                                                                                                                      • Replaces existing state in the cache (if any) with the values expressed by serializedState.

                                                                                                                                        Called when hydrating a cache (server side rendering, or offline storage), and also (potentially) during hot reloads.

                                                                                                                                      setLink: (newLink: ApolloLink) => void;
                                                                                                                                      • Define a new ApolloLink (or link chain) that Apollo Client will use.

                                                                                                                                      method setLocalStateFragmentMatcher

                                                                                                                                      setLocalStateFragmentMatcher: (fragmentMatcher: FragmentMatcher) => void;
                                                                                                                                      • Set a custom local state fragment matcher.

                                                                                                                                      method setResolvers

                                                                                                                                      setResolvers: (resolvers: Resolvers | Resolvers[]) => void;
                                                                                                                                      • Set (override existing) local resolvers.

                                                                                                                                      method stop

                                                                                                                                      stop: () => void;
                                                                                                                                      • Call this method to terminate any active client processes, making it safe to dispose of this ApolloClient instance.

                                                                                                                                      method subscribe

                                                                                                                                      subscribe: <T = any, TVariables extends OperationVariables = OperationVariables>(
                                                                                                                                      options: SubscriptionOptions<TVariables, T>
                                                                                                                                      ) => Observable<FetchResult<T, Record<string, any>, Record<string, any>>>;
                                                                                                                                      • This subscribes to a graphql subscription according to the options specified and returns an Observable which either emits received data or an error.

                                                                                                                                      method watchQuery

                                                                                                                                      watchQuery: <
                                                                                                                                      T = any,
                                                                                                                                      TVariables extends OperationVariables = OperationVariables
                                                                                                                                      >(
                                                                                                                                      options: WatchQueryOptions<TVariables, T>
                                                                                                                                      ) => ObservableQuery<T, TVariables>;
                                                                                                                                      • This watches the cache store of the query according to the options specified and returns an ObservableQuery. We can subscribe to this ObservableQuery and receive updated results through a GraphQL observer when the cache store changes.

                                                                                                                                        Note that this method is not an implementation of GraphQL subscriptions. Rather, it uses Apollo's store in order to reactively deliver updates to your query results.

                                                                                                                                        For example, suppose you call watchQuery on a GraphQL query that fetches a person's first and last name and this person has a particular object identifier, provided by dataIdFromObject. Later, a different query fetches that same person's first and last name and the first name has now changed. Then, any observers associated with the results of the first query will be updated with a new result object.

                                                                                                                                        Note that if the cache does not change, the subscriber will *not* be notified.

                                                                                                                                        See [here](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3#.3mb0cbcmc) for a description of store reactivity.

                                                                                                                                      method writeFragment

                                                                                                                                      writeFragment: <TData = any, TVariables = OperationVariables>(
                                                                                                                                      options: DataProxy.WriteFragmentOptions<TData, TVariables>
                                                                                                                                      ) => Reference | undefined;
                                                                                                                                      • Writes some data in the shape of the provided GraphQL fragment directly to the store. This method will write to a GraphQL fragment from any arbitrary id that is currently cached, unlike writeQuery which will only write from the root query.

                                                                                                                                        You must pass in a GraphQL document with a single fragment or a document with multiple fragments that represent what you are writing. If you pass in a document with multiple fragments then you must also specify a fragmentName.

                                                                                                                                      method writeQuery

                                                                                                                                      writeQuery: <TData = any, TVariables = OperationVariables>(
                                                                                                                                      options: DataProxy.WriteQueryOptions<TData, TVariables>
                                                                                                                                      ) => Reference | undefined;
                                                                                                                                      • Writes some data in the shape of the provided GraphQL query directly to the store. This method will start at the root query. To start at a specific id returned by dataIdFromObject then use writeFragment.

                                                                                                                                      class ApolloError

                                                                                                                                      class ApolloError extends Error {}

                                                                                                                                        constructor

                                                                                                                                        constructor({
                                                                                                                                        graphQLErrors,
                                                                                                                                        protocolErrors,
                                                                                                                                        clientErrors,
                                                                                                                                        networkError,
                                                                                                                                        errorMessage,
                                                                                                                                        extraInfo,
                                                                                                                                        }: ApolloErrorOptions);

                                                                                                                                          property clientErrors

                                                                                                                                          clientErrors: readonly Error[];

                                                                                                                                            property extraInfo

                                                                                                                                            extraInfo: any;

                                                                                                                                              property graphQLErrors

                                                                                                                                              graphQLErrors: GraphQLErrors;

                                                                                                                                                property message

                                                                                                                                                message: string;

                                                                                                                                                  property name

                                                                                                                                                  name: string;

                                                                                                                                                    property networkError

                                                                                                                                                    networkError: Error | ServerParseError | ServerError;

                                                                                                                                                      property protocolErrors

                                                                                                                                                      protocolErrors: readonly {
                                                                                                                                                      message: string;
                                                                                                                                                      extensions?: GraphQLErrorExtensions[];
                                                                                                                                                      }[];
                                                                                                                                                        class ApolloLink {}

                                                                                                                                                          constructor

                                                                                                                                                          constructor(request?: RequestHandler);

                                                                                                                                                            method concat

                                                                                                                                                            static concat: (
                                                                                                                                                            first: ApolloLink | RequestHandler,
                                                                                                                                                            second: ApolloLink | RequestHandler
                                                                                                                                                            ) => ApolloLink;

                                                                                                                                                              method empty

                                                                                                                                                              static empty: () => ApolloLink;

                                                                                                                                                                method execute

                                                                                                                                                                static execute: (
                                                                                                                                                                link: ApolloLink,
                                                                                                                                                                operation: GraphQLRequest
                                                                                                                                                                ) => Observable<
                                                                                                                                                                FetchResult<Record<string, any>, Record<string, any>, Record<string, any>>
                                                                                                                                                                >;

                                                                                                                                                                  method from

                                                                                                                                                                  static from: (links: (ApolloLink | RequestHandler)[]) => ApolloLink;

                                                                                                                                                                    method onError

                                                                                                                                                                    protected onError: (
                                                                                                                                                                    error: any,
                                                                                                                                                                    observer?: Observer<
                                                                                                                                                                    FetchResult<
                                                                                                                                                                    Record<string, any>,
                                                                                                                                                                    Record<string, any>,
                                                                                                                                                                    Record<string, any>
                                                                                                                                                                    >
                                                                                                                                                                    >
                                                                                                                                                                    ) => false | void;

                                                                                                                                                                      method request

                                                                                                                                                                      request: (
                                                                                                                                                                      operation: Operation,
                                                                                                                                                                      forward?: NextLink
                                                                                                                                                                      ) => Observable<FetchResult> | null;

                                                                                                                                                                        method setOnError

                                                                                                                                                                        setOnError: (fn: ApolloLink['onError']) => this;

                                                                                                                                                                          method split

                                                                                                                                                                          static split: (
                                                                                                                                                                          test: (op: Operation) => boolean,
                                                                                                                                                                          left: ApolloLink | RequestHandler,
                                                                                                                                                                          right?: ApolloLink | RequestHandler
                                                                                                                                                                          ) => ApolloLink;

                                                                                                                                                                            class DocumentTransform

                                                                                                                                                                            class DocumentTransform {}

                                                                                                                                                                              constructor

                                                                                                                                                                              constructor(transform: TransformFn, options?: DocumentTransformOptions);

                                                                                                                                                                                method concat

                                                                                                                                                                                concat: (otherTransform: DocumentTransform) => DocumentTransform;

                                                                                                                                                                                  method identity

                                                                                                                                                                                  static identity: () => DocumentTransform;

                                                                                                                                                                                    method resetCache

                                                                                                                                                                                    resetCache: () => void;
                                                                                                                                                                                    • Resets the internal cache of this transform, if it has one.

                                                                                                                                                                                    method split

                                                                                                                                                                                    static split: (
                                                                                                                                                                                    predicate: (document: DocumentNode) => boolean,
                                                                                                                                                                                    left: DocumentTransform,
                                                                                                                                                                                    right?: DocumentTransform
                                                                                                                                                                                    ) => DocumentTransform & { left: DocumentTransform; right: DocumentTransform };

                                                                                                                                                                                      method transformDocument

                                                                                                                                                                                      transformDocument: (document: DocumentNode) => DocumentNode;
                                                                                                                                                                                        class HttpLink extends ApolloLink {}

                                                                                                                                                                                          constructor

                                                                                                                                                                                          constructor(options?: HttpOptions);

                                                                                                                                                                                            property options

                                                                                                                                                                                            options: HttpOptions;

                                                                                                                                                                                              class InMemoryCache

                                                                                                                                                                                              class InMemoryCache extends ApolloCache<NormalizedCacheObject> {}

                                                                                                                                                                                                constructor

                                                                                                                                                                                                constructor(config?: InMemoryCacheConfig);

                                                                                                                                                                                                  property assumeImmutableResults

                                                                                                                                                                                                  readonly assumeImmutableResults: boolean;

                                                                                                                                                                                                    property config

                                                                                                                                                                                                    protected config: InMemoryCacheConfig;

                                                                                                                                                                                                      property makeVar

                                                                                                                                                                                                      readonly makeVar: <T>(value: T) => ReactiveVar<T>;

                                                                                                                                                                                                        property policies

                                                                                                                                                                                                        readonly policies: Policies;

                                                                                                                                                                                                          method batch

                                                                                                                                                                                                          batch: <TUpdateResult>(
                                                                                                                                                                                                          options: Cache.BatchOptions<InMemoryCache, TUpdateResult>
                                                                                                                                                                                                          ) => TUpdateResult;

                                                                                                                                                                                                            method broadcastWatches

                                                                                                                                                                                                            protected broadcastWatches: (options?: BroadcastOptions) => void;

                                                                                                                                                                                                              method diff

                                                                                                                                                                                                              diff: <TData, TVariables extends OperationVariables = any>(
                                                                                                                                                                                                              options: Cache.DiffOptions<TData, TVariables>
                                                                                                                                                                                                              ) => Cache.DiffResult<TData>;

                                                                                                                                                                                                                method evict

                                                                                                                                                                                                                evict: (options: Cache.EvictOptions) => boolean;

                                                                                                                                                                                                                  method extract

                                                                                                                                                                                                                  extract: (optimistic?: boolean) => NormalizedCacheObject;

                                                                                                                                                                                                                    method gc

                                                                                                                                                                                                                    gc: (options?: {
                                                                                                                                                                                                                    resetResultCache?: boolean;
                                                                                                                                                                                                                    resetResultIdentities?: boolean;
                                                                                                                                                                                                                    }) => string[];

                                                                                                                                                                                                                      method identify

                                                                                                                                                                                                                      identify: (object: StoreObject | Reference) => string | undefined;

                                                                                                                                                                                                                        method modify

                                                                                                                                                                                                                        modify: <Entity extends Record<string, any> = Record<string, any>>(
                                                                                                                                                                                                                        options: Cache.ModifyOptions<Entity>
                                                                                                                                                                                                                        ) => boolean;

                                                                                                                                                                                                                          method performTransaction

                                                                                                                                                                                                                          performTransaction: (
                                                                                                                                                                                                                          update: (cache: InMemoryCache) => any,
                                                                                                                                                                                                                          optimisticId?: string | null
                                                                                                                                                                                                                          ) => any;

                                                                                                                                                                                                                            method read

                                                                                                                                                                                                                            read: <T>(options: Cache.ReadOptions) => T | null;

                                                                                                                                                                                                                              method release

                                                                                                                                                                                                                              release: (rootId: string, optimistic?: boolean) => number;

                                                                                                                                                                                                                                method removeOptimistic

                                                                                                                                                                                                                                removeOptimistic: (idToRemove: string) => void;

                                                                                                                                                                                                                                  method reset

                                                                                                                                                                                                                                  reset: (options?: Cache.ResetOptions) => Promise<void>;

                                                                                                                                                                                                                                    method restore

                                                                                                                                                                                                                                    restore: (data: NormalizedCacheObject) => this;

                                                                                                                                                                                                                                      method retain

                                                                                                                                                                                                                                      retain: (rootId: string, optimistic?: boolean) => number;

                                                                                                                                                                                                                                        method transformDocument

                                                                                                                                                                                                                                        transformDocument: (document: DocumentNode) => DocumentNode;

                                                                                                                                                                                                                                          method watch

                                                                                                                                                                                                                                          watch: <TData = any, TVariables = any>(
                                                                                                                                                                                                                                          watch: Cache.WatchOptions<TData, TVariables>
                                                                                                                                                                                                                                          ) => () => void;

                                                                                                                                                                                                                                            method write

                                                                                                                                                                                                                                            write: (options: Cache.WriteOptions) => Reference | undefined;

                                                                                                                                                                                                                                              class MissingFieldError

                                                                                                                                                                                                                                              class MissingFieldError extends Error {}

                                                                                                                                                                                                                                                constructor

                                                                                                                                                                                                                                                constructor(
                                                                                                                                                                                                                                                message: string,
                                                                                                                                                                                                                                                path: MissingTree | (string | number)[],
                                                                                                                                                                                                                                                query: DocumentNode,
                                                                                                                                                                                                                                                variables?: Record<string, any>
                                                                                                                                                                                                                                                );

                                                                                                                                                                                                                                                  property message

                                                                                                                                                                                                                                                  readonly message: string;

                                                                                                                                                                                                                                                    property missing

                                                                                                                                                                                                                                                    readonly missing: MissingTree;

                                                                                                                                                                                                                                                      property path

                                                                                                                                                                                                                                                      readonly path: MissingTree | (string | number)[];

                                                                                                                                                                                                                                                        property query

                                                                                                                                                                                                                                                        readonly query: DocumentNode;

                                                                                                                                                                                                                                                          property variables

                                                                                                                                                                                                                                                          readonly variables?: Record<string, any>;

                                                                                                                                                                                                                                                            class ObservableQuery

                                                                                                                                                                                                                                                            class ObservableQuery<
                                                                                                                                                                                                                                                            TData = any,
                                                                                                                                                                                                                                                            TVariables extends OperationVariables = OperationVariables
                                                                                                                                                                                                                                                            > extends Observable<ApolloQueryResult<TData>> {}

                                                                                                                                                                                                                                                              constructor

                                                                                                                                                                                                                                                              constructor({
                                                                                                                                                                                                                                                              queryManager,
                                                                                                                                                                                                                                                              queryInfo,
                                                                                                                                                                                                                                                              options,
                                                                                                                                                                                                                                                              }: {
                                                                                                                                                                                                                                                              queryManager: QueryManager<any>;
                                                                                                                                                                                                                                                              queryInfo: QueryInfo;
                                                                                                                                                                                                                                                              options: WatchQueryOptions<TVariables, TData>;
                                                                                                                                                                                                                                                              });

                                                                                                                                                                                                                                                                property options

                                                                                                                                                                                                                                                                readonly options: WatchQueryOptions<TVariables, TData>;

                                                                                                                                                                                                                                                                  property query

                                                                                                                                                                                                                                                                  readonly query: TypedDocumentNode<TData, TVariables>;

                                                                                                                                                                                                                                                                    property queryId

                                                                                                                                                                                                                                                                    readonly queryId: string;

                                                                                                                                                                                                                                                                      property queryName

                                                                                                                                                                                                                                                                      readonly queryName?: string;

                                                                                                                                                                                                                                                                        property variables

                                                                                                                                                                                                                                                                        readonly variables: OperationVariables;
                                                                                                                                                                                                                                                                        • An object containing the variables that were provided for the query.

                                                                                                                                                                                                                                                                        method fetchMore

                                                                                                                                                                                                                                                                        fetchMore: <
                                                                                                                                                                                                                                                                        TFetchData = TData,
                                                                                                                                                                                                                                                                        TFetchVars extends OperationVariables = TVariables
                                                                                                                                                                                                                                                                        >(
                                                                                                                                                                                                                                                                        fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
                                                                                                                                                                                                                                                                        updateQuery?: (
                                                                                                                                                                                                                                                                        previousQueryResult: TData,
                                                                                                                                                                                                                                                                        options: { fetchMoreResult: TFetchData; variables: TFetchVars }
                                                                                                                                                                                                                                                                        ) => TData;
                                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                                        ) => Promise<ApolloQueryResult<TFetchData>>;
                                                                                                                                                                                                                                                                        • A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).

                                                                                                                                                                                                                                                                        method getCurrentResult

                                                                                                                                                                                                                                                                        getCurrentResult: (saveAsLastResult?: boolean) => ApolloQueryResult<TData>;

                                                                                                                                                                                                                                                                          method getLastError

                                                                                                                                                                                                                                                                          getLastError: (variablesMustMatch?: boolean) => ApolloError | undefined;

                                                                                                                                                                                                                                                                            method getLastResult

                                                                                                                                                                                                                                                                            getLastResult: (
                                                                                                                                                                                                                                                                            variablesMustMatch?: boolean
                                                                                                                                                                                                                                                                            ) => ApolloQueryResult<TData> | undefined;

                                                                                                                                                                                                                                                                              method hasObservers

                                                                                                                                                                                                                                                                              hasObservers: () => boolean;

                                                                                                                                                                                                                                                                                method isDifferentFromLastResult

                                                                                                                                                                                                                                                                                isDifferentFromLastResult: (
                                                                                                                                                                                                                                                                                newResult: ApolloQueryResult<TData>,
                                                                                                                                                                                                                                                                                variables?: TVariables
                                                                                                                                                                                                                                                                                ) => boolean | undefined;

                                                                                                                                                                                                                                                                                  method refetch

                                                                                                                                                                                                                                                                                  refetch: (variables?: Partial<TVariables>) => Promise<ApolloQueryResult<TData>>;
                                                                                                                                                                                                                                                                                  • Update the variables of this observable query, and fetch the new results. This method should be preferred over setVariables in most use cases.

                                                                                                                                                                                                                                                                                    Parameter variables

                                                                                                                                                                                                                                                                                    The new set of variables. If there are missing variables, the previous values of those variables will be used.

                                                                                                                                                                                                                                                                                  method reobserve

                                                                                                                                                                                                                                                                                  reobserve: (
                                                                                                                                                                                                                                                                                  newOptions?: Partial<WatchQueryOptions<TVariables, TData>>,
                                                                                                                                                                                                                                                                                  newNetworkStatus?: NetworkStatus
                                                                                                                                                                                                                                                                                  ) => Promise<ApolloQueryResult<TData>>;

                                                                                                                                                                                                                                                                                    method reobserveAsConcast

                                                                                                                                                                                                                                                                                    reobserveAsConcast: (
                                                                                                                                                                                                                                                                                    newOptions?: Partial<WatchQueryOptions<TVariables, TData>>,
                                                                                                                                                                                                                                                                                    newNetworkStatus?: NetworkStatus
                                                                                                                                                                                                                                                                                    ) => Concast<ApolloQueryResult<TData>>;

                                                                                                                                                                                                                                                                                      method resetLastResults

                                                                                                                                                                                                                                                                                      resetLastResults: () => void;

                                                                                                                                                                                                                                                                                        method resetQueryStoreErrors

                                                                                                                                                                                                                                                                                        resetQueryStoreErrors: () => void;

                                                                                                                                                                                                                                                                                          method resubscribeAfterError

                                                                                                                                                                                                                                                                                          resubscribeAfterError: {
                                                                                                                                                                                                                                                                                          (
                                                                                                                                                                                                                                                                                          onNext: (value: ApolloQueryResult<TData>) => void,
                                                                                                                                                                                                                                                                                          onError?: (error: any) => void,
                                                                                                                                                                                                                                                                                          onComplete?: () => void
                                                                                                                                                                                                                                                                                          ): ObservableSubscription;
                                                                                                                                                                                                                                                                                          (observer: Observer<ApolloQueryResult<TData>>): ObservableSubscription;
                                                                                                                                                                                                                                                                                          };

                                                                                                                                                                                                                                                                                            method result

                                                                                                                                                                                                                                                                                            result: () => Promise<ApolloQueryResult<TData>>;

                                                                                                                                                                                                                                                                                              method setOptions

                                                                                                                                                                                                                                                                                              setOptions: (
                                                                                                                                                                                                                                                                                              newOptions: Partial<WatchQueryOptions<TVariables, TData>>
                                                                                                                                                                                                                                                                                              ) => Promise<ApolloQueryResult<TData>>;

                                                                                                                                                                                                                                                                                                method setVariables

                                                                                                                                                                                                                                                                                                setVariables: (
                                                                                                                                                                                                                                                                                                variables: TVariables
                                                                                                                                                                                                                                                                                                ) => Promise<ApolloQueryResult<TData> | void>;
                                                                                                                                                                                                                                                                                                • Update the variables of this observable query, and fetch the new results if they've changed. Most users should prefer refetch instead of setVariables in order to to be properly notified of results even when they come from the cache.

                                                                                                                                                                                                                                                                                                  Note: the next callback will *not* fire if the variables have not changed or if the result is coming from cache.

                                                                                                                                                                                                                                                                                                  Note: the promise will return the old results immediately if the variables have not changed.

                                                                                                                                                                                                                                                                                                  Note: the promise will return null immediately if the query is not active (there are no subscribers).

                                                                                                                                                                                                                                                                                                  Parameter variables

                                                                                                                                                                                                                                                                                                  The new set of variables. If there are missing variables, the previous values of those variables will be used.

                                                                                                                                                                                                                                                                                                method silentSetOptions

                                                                                                                                                                                                                                                                                                silentSetOptions: (
                                                                                                                                                                                                                                                                                                newOptions: Partial<WatchQueryOptions<TVariables, TData>>
                                                                                                                                                                                                                                                                                                ) => void;

                                                                                                                                                                                                                                                                                                  method startPolling

                                                                                                                                                                                                                                                                                                  startPolling: (pollInterval: number) => void;
                                                                                                                                                                                                                                                                                                  • A function that instructs the query to begin re-executing at a specified interval (in milliseconds).

                                                                                                                                                                                                                                                                                                  method stopPolling

                                                                                                                                                                                                                                                                                                  stopPolling: () => void;
                                                                                                                                                                                                                                                                                                  • A function that instructs the query to stop polling after a previous call to startPolling.

                                                                                                                                                                                                                                                                                                  method subscribeToMore

                                                                                                                                                                                                                                                                                                  subscribeToMore: <
                                                                                                                                                                                                                                                                                                  TSubscriptionData = TData,
                                                                                                                                                                                                                                                                                                  TSubscriptionVariables extends OperationVariables = TVariables
                                                                                                                                                                                                                                                                                                  >(
                                                                                                                                                                                                                                                                                                  options: SubscribeToMoreOptions<
                                                                                                                                                                                                                                                                                                  TData,
                                                                                                                                                                                                                                                                                                  TSubscriptionVariables,
                                                                                                                                                                                                                                                                                                  TSubscriptionData
                                                                                                                                                                                                                                                                                                  >
                                                                                                                                                                                                                                                                                                  ) => () => void;
                                                                                                                                                                                                                                                                                                  • A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.

                                                                                                                                                                                                                                                                                                    This function returns _another_ function that you can call to terminate the subscription.

                                                                                                                                                                                                                                                                                                  method updateQuery

                                                                                                                                                                                                                                                                                                  updateQuery: <TVars extends OperationVariables = TVariables>(
                                                                                                                                                                                                                                                                                                  mapFn: (
                                                                                                                                                                                                                                                                                                  previousQueryResult: TData,
                                                                                                                                                                                                                                                                                                  options: Pick<WatchQueryOptions<TVars, TData>, 'variables'>
                                                                                                                                                                                                                                                                                                  ) => TData
                                                                                                                                                                                                                                                                                                  ) => void;
                                                                                                                                                                                                                                                                                                  • A function that enables you to update the query's cached result without executing a followup GraphQL operation.

                                                                                                                                                                                                                                                                                                    See [using updateQuery and updateFragment](https://www.apollographql.com/docs/react/caching/cache-interaction/#using-updatequery-and-updatefragment) for additional information.

                                                                                                                                                                                                                                                                                                  Interfaces

                                                                                                                                                                                                                                                                                                  interface ApolloClientOptions

                                                                                                                                                                                                                                                                                                  interface ApolloClientOptions<TCacheShape> {}

                                                                                                                                                                                                                                                                                                    property assumeImmutableResults

                                                                                                                                                                                                                                                                                                    assumeImmutableResults?: boolean;
                                                                                                                                                                                                                                                                                                    • If true, Apollo Client will assume results read from the cache are never mutated by application code, which enables substantial performance optimizations.

                                                                                                                                                                                                                                                                                                    property cache

                                                                                                                                                                                                                                                                                                    cache: ApolloCache<TCacheShape>;
                                                                                                                                                                                                                                                                                                    • The cache that Apollo Client should use to store query results locally. The recommended cache is InMemoryCache, which is provided by the @apollo/client package.

                                                                                                                                                                                                                                                                                                      For more information, see [Configuring the cache](https://www.apollographql.com/docs/react/caching/cache-configuration/).

                                                                                                                                                                                                                                                                                                    property connectToDevTools

                                                                                                                                                                                                                                                                                                    connectToDevTools?: boolean;
                                                                                                                                                                                                                                                                                                    • If true, the [Apollo Client Devtools](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) browser extension can connect to Apollo Client.

                                                                                                                                                                                                                                                                                                      The default value is false in production and true in development (if there is a window object).

                                                                                                                                                                                                                                                                                                    property credentials

                                                                                                                                                                                                                                                                                                    credentials?: string;

                                                                                                                                                                                                                                                                                                      property defaultContext

                                                                                                                                                                                                                                                                                                      defaultContext?: Partial<DefaultContext>;

                                                                                                                                                                                                                                                                                                        property defaultOptions

                                                                                                                                                                                                                                                                                                        defaultOptions?: DefaultOptions;
                                                                                                                                                                                                                                                                                                        • Provide this object to set application-wide default values for options you can provide to the watchQuery, query, and mutate functions. See below for an example object.

                                                                                                                                                                                                                                                                                                          See this [example object](https://www.apollographql.com/docs/react/api/core/ApolloClient#example-defaultoptions-object).

                                                                                                                                                                                                                                                                                                        property documentTransform

                                                                                                                                                                                                                                                                                                        documentTransform?: DocumentTransform;

                                                                                                                                                                                                                                                                                                          property fragmentMatcher

                                                                                                                                                                                                                                                                                                          fragmentMatcher?: FragmentMatcher;

                                                                                                                                                                                                                                                                                                            property headers

                                                                                                                                                                                                                                                                                                            headers?: Record<string, string>;
                                                                                                                                                                                                                                                                                                            • An object representing headers to include in every HTTP request, such as {Authorization: 'Bearer 1234'}

                                                                                                                                                                                                                                                                                                              This value will be ignored when using the link option.

                                                                                                                                                                                                                                                                                                            link?: ApolloLink;
                                                                                                                                                                                                                                                                                                            • You can provide an ApolloLink instance to serve as Apollo Client's network layer. For more information, see [Advanced HTTP networking](https://www.apollographql.com/docs/react/networking/advanced-http-networking/).

                                                                                                                                                                                                                                                                                                              One of uri or link is **required**. If you provide both, link takes precedence.

                                                                                                                                                                                                                                                                                                            property name

                                                                                                                                                                                                                                                                                                            name?: string;
                                                                                                                                                                                                                                                                                                            • A custom name (e.g., iOS) that identifies this particular client among your set of clients. Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.

                                                                                                                                                                                                                                                                                                            property queryDeduplication

                                                                                                                                                                                                                                                                                                            queryDeduplication?: boolean;
                                                                                                                                                                                                                                                                                                            • If false, Apollo Client sends every created query to the server, even if a _completely_ identical query (identical in terms of query string, variable values, and operationName) is already in flight.

                                                                                                                                                                                                                                                                                                            property resolvers

                                                                                                                                                                                                                                                                                                            resolvers?: Resolvers | Resolvers[];

                                                                                                                                                                                                                                                                                                              property ssrForceFetchDelay

                                                                                                                                                                                                                                                                                                              ssrForceFetchDelay?: number;
                                                                                                                                                                                                                                                                                                              • The time interval (in milliseconds) before Apollo Client force-fetches queries after a server-side render.

                                                                                                                                                                                                                                                                                                              property ssrMode

                                                                                                                                                                                                                                                                                                              ssrMode?: boolean;
                                                                                                                                                                                                                                                                                                              • When using Apollo Client for [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/), set this to true so that the [getDataFromTree function](../react/ssr/#getdatafromtree) can work effectively.

                                                                                                                                                                                                                                                                                                              property typeDefs

                                                                                                                                                                                                                                                                                                              typeDefs?: string | string[] | DocumentNode | DocumentNode[];

                                                                                                                                                                                                                                                                                                                property uri

                                                                                                                                                                                                                                                                                                                uri?: string | UriFunction;
                                                                                                                                                                                                                                                                                                                • The URI of the GraphQL endpoint that Apollo Client will communicate with.

                                                                                                                                                                                                                                                                                                                  One of uri or link is **required**. If you provide both, link takes precedence.

                                                                                                                                                                                                                                                                                                                property version

                                                                                                                                                                                                                                                                                                                version?: string;
                                                                                                                                                                                                                                                                                                                • A custom version that identifies the current version of this particular client (e.g., 1.2). Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.

                                                                                                                                                                                                                                                                                                                  This is **not** the version of Apollo Client that you are using, but rather any version string that helps you differentiate between versions of your client.

                                                                                                                                                                                                                                                                                                                interface ApolloContextValue

                                                                                                                                                                                                                                                                                                                interface ApolloContextValue {}

                                                                                                                                                                                                                                                                                                                  property client

                                                                                                                                                                                                                                                                                                                  client?: ApolloClient<object>;

                                                                                                                                                                                                                                                                                                                    property renderPromises

                                                                                                                                                                                                                                                                                                                    renderPromises?: RenderPromises;

                                                                                                                                                                                                                                                                                                                      interface ApolloPayloadResult

                                                                                                                                                                                                                                                                                                                      interface ApolloPayloadResult<
                                                                                                                                                                                                                                                                                                                      TData = Record<string, any>,
                                                                                                                                                                                                                                                                                                                      TExtensions = Record<string, any>
                                                                                                                                                                                                                                                                                                                      > {}

                                                                                                                                                                                                                                                                                                                        property errors

                                                                                                                                                                                                                                                                                                                        errors?: ReadonlyArray<Error | string>;

                                                                                                                                                                                                                                                                                                                          property payload

                                                                                                                                                                                                                                                                                                                          payload: SingleExecutionResult | ExecutionPatchResult | null;

                                                                                                                                                                                                                                                                                                                            interface ApolloQueryResult

                                                                                                                                                                                                                                                                                                                            interface ApolloQueryResult<T> {}

                                                                                                                                                                                                                                                                                                                              property data

                                                                                                                                                                                                                                                                                                                              data: T;

                                                                                                                                                                                                                                                                                                                                property error

                                                                                                                                                                                                                                                                                                                                error?: ApolloError;
                                                                                                                                                                                                                                                                                                                                • The single Error object that is passed to onError and useQuery hooks, and is often thrown during manual client.query calls. This will contain both a NetworkError field and any GraphQLErrors. See https://www.apollographql.com/docs/react/data/error-handling/ for more information.

                                                                                                                                                                                                                                                                                                                                property errors

                                                                                                                                                                                                                                                                                                                                errors?: ReadonlyArray<GraphQLError>;
                                                                                                                                                                                                                                                                                                                                • A list of any errors that occurred during server-side execution of a GraphQL operation. See https://www.apollographql.com/docs/react/data/error-handling/ for more information.

                                                                                                                                                                                                                                                                                                                                property loading

                                                                                                                                                                                                                                                                                                                                loading: boolean;

                                                                                                                                                                                                                                                                                                                                  property networkStatus

                                                                                                                                                                                                                                                                                                                                  networkStatus: NetworkStatus;

                                                                                                                                                                                                                                                                                                                                    property partial

                                                                                                                                                                                                                                                                                                                                    partial?: boolean;

                                                                                                                                                                                                                                                                                                                                      interface BackgroundQueryHookOptions

                                                                                                                                                                                                                                                                                                                                      interface BackgroundQueryHookOptions<
                                                                                                                                                                                                                                                                                                                                      TData = unknown,
                                                                                                                                                                                                                                                                                                                                      TVariables extends OperationVariables = OperationVariables
                                                                                                                                                                                                                                                                                                                                      > extends Pick<
                                                                                                                                                                                                                                                                                                                                      QueryHookOptions<TData, TVariables>,
                                                                                                                                                                                                                                                                                                                                      | 'client'
                                                                                                                                                                                                                                                                                                                                      | 'variables'
                                                                                                                                                                                                                                                                                                                                      | 'errorPolicy'
                                                                                                                                                                                                                                                                                                                                      | 'context'
                                                                                                                                                                                                                                                                                                                                      | 'canonizeResults'
                                                                                                                                                                                                                                                                                                                                      | 'returnPartialData'
                                                                                                                                                                                                                                                                                                                                      | 'refetchWritePolicy'
                                                                                                                                                                                                                                                                                                                                      > {}

                                                                                                                                                                                                                                                                                                                                        property fetchPolicy

                                                                                                                                                                                                                                                                                                                                        fetchPolicy?: BackgroundQueryHookFetchPolicy;

                                                                                                                                                                                                                                                                                                                                          property queryKey

                                                                                                                                                                                                                                                                                                                                          queryKey?: string | number | any[];

                                                                                                                                                                                                                                                                                                                                            property skip

                                                                                                                                                                                                                                                                                                                                            skip?: boolean;
                                                                                                                                                                                                                                                                                                                                            • If true, the query is not executed. The default value is false.

                                                                                                                                                                                                                                                                                                                                              Example 1

                                                                                                                                                                                                                                                                                                                                              Recommended usage of skipToken:

                                                                                                                                                                                                                                                                                                                                              import { skipToken, useBackgroundQuery } from '@apollo/client';
                                                                                                                                                                                                                                                                                                                                              const [queryRef] = useBackgroundQuery(query, id ? { variables: { id } } : skipToken);

                                                                                                                                                                                                                                                                                                                                              Deprecated

                                                                                                                                                                                                                                                                                                                                              We recommend using skipToken in place of the skip option as it is more type-safe.

                                                                                                                                                                                                                                                                                                                                              This option is deprecated and only supported to ease the migration from useQuery. It will be removed in a future release.

                                                                                                                                                                                                                                                                                                                                              1. Operation options

                                                                                                                                                                                                                                                                                                                                            interface BaseMutationOptions

                                                                                                                                                                                                                                                                                                                                            interface BaseMutationOptions<
                                                                                                                                                                                                                                                                                                                                            TData = any,
                                                                                                                                                                                                                                                                                                                                            TVariables = OperationVariables,
                                                                                                                                                                                                                                                                                                                                            TContext = DefaultContext,
                                                                                                                                                                                                                                                                                                                                            TCache extends ApolloCache<any> = ApolloCache<any>
                                                                                                                                                                                                                                                                                                                                            > extends MutationSharedOptions<TData, TVariables, TContext, TCache> {}

                                                                                                                                                                                                                                                                                                                                              property client

                                                                                                                                                                                                                                                                                                                                              client?: ApolloClient<object>;
                                                                                                                                                                                                                                                                                                                                              • The instance of ApolloClient to use to execute the mutation.

                                                                                                                                                                                                                                                                                                                                                By default, the instance that's passed down via context is used, but you can provide a different instance here.

                                                                                                                                                                                                                                                                                                                                                2. Networking options

                                                                                                                                                                                                                                                                                                                                              property ignoreResults

                                                                                                                                                                                                                                                                                                                                              ignoreResults?: boolean;
                                                                                                                                                                                                                                                                                                                                              • If true, the mutation's data property is not updated with the mutation's result.

                                                                                                                                                                                                                                                                                                                                                The default value is false.

                                                                                                                                                                                                                                                                                                                                                1. Operation options

                                                                                                                                                                                                                                                                                                                                              property notifyOnNetworkStatusChange

                                                                                                                                                                                                                                                                                                                                              notifyOnNetworkStatusChange?: boolean;
                                                                                                                                                                                                                                                                                                                                              • If true, the in-progress mutation's associated component re-renders whenever the network status changes or a network error occurs.

                                                                                                                                                                                                                                                                                                                                                The default value is false.

                                                                                                                                                                                                                                                                                                                                                2. Networking options

                                                                                                                                                                                                                                                                                                                                              property onCompleted

                                                                                                                                                                                                                                                                                                                                              onCompleted?: (data: TData, clientOptions?: BaseMutationOptions) => void;
                                                                                                                                                                                                                                                                                                                                              • A callback function that's called when your mutation successfully completes with zero errors (or if errorPolicy is ignore and partial data is returned).

                                                                                                                                                                                                                                                                                                                                                This function is passed the mutation's result data and any options passed to the mutation.

                                                                                                                                                                                                                                                                                                                                                1. Operation options

                                                                                                                                                                                                                                                                                                                                              property onError

                                                                                                                                                                                                                                                                                                                                              onError?: (error: ApolloError, clientOptions?: BaseMutationOptions) => void;
                                                                                                                                                                                                                                                                                                                                              • A callback function that's called when the mutation encounters one or more errors (unless errorPolicy is ignore).

                                                                                                                                                                                                                                                                                                                                                This function is passed an [ApolloError](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/errors/index.ts#L36-L39) object that contains either a networkError object or a graphQLErrors array, depending on the error(s) that occurred, as well as any options passed the mutation.

                                                                                                                                                                                                                                                                                                                                                1. Operation options

                                                                                                                                                                                                                                                                                                                                              interface BaseQueryOptions

                                                                                                                                                                                                                                                                                                                                              interface BaseQueryOptions<
                                                                                                                                                                                                                                                                                                                                              TVariables extends OperationVariables = OperationVariables,
                                                                                                                                                                                                                                                                                                                                              TData = any
                                                                                                                                                                                                                                                                                                                                              > extends SharedWatchQueryOptions<TVariables, TData> {}

                                                                                                                                                                                                                                                                                                                                                property client

                                                                                                                                                                                                                                                                                                                                                client?: ApolloClient<any>;
                                                                                                                                                                                                                                                                                                                                                • The instance of ApolloClient to use to execute the query.

                                                                                                                                                                                                                                                                                                                                                  By default, the instance that's passed down via context is used, but you can provide a different instance here.

                                                                                                                                                                                                                                                                                                                                                  1. Operation options

                                                                                                                                                                                                                                                                                                                                                property context

                                                                                                                                                                                                                                                                                                                                                context?: DefaultContext;
                                                                                                                                                                                                                                                                                                                                                • If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the context object that's passed along your link chain.

                                                                                                                                                                                                                                                                                                                                                  2. Networking options

                                                                                                                                                                                                                                                                                                                                                property ssr

                                                                                                                                                                                                                                                                                                                                                ssr?: boolean;
                                                                                                                                                                                                                                                                                                                                                • Pass false to skip executing the query during [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/).

                                                                                                                                                                                                                                                                                                                                                  2. Networking options

                                                                                                                                                                                                                                                                                                                                                interface BaseSubscriptionOptions

                                                                                                                                                                                                                                                                                                                                                interface BaseSubscriptionOptions<
                                                                                                                                                                                                                                                                                                                                                TData = any,
                                                                                                                                                                                                                                                                                                                                                TVariables extends OperationVariables = OperationVariables
                                                                                                                                                                                                                                                                                                                                                > {}

                                                                                                                                                                                                                                                                                                                                                  property client

                                                                                                                                                                                                                                                                                                                                                  client?: ApolloClient<object>;
                                                                                                                                                                                                                                                                                                                                                  • An ApolloClient instance. By default useSubscription / Subscription uses the client passed down via context, but a different client can be passed in.

                                                                                                                                                                                                                                                                                                                                                  property context

                                                                                                                                                                                                                                                                                                                                                  context?: DefaultContext;
                                                                                                                                                                                                                                                                                                                                                  • Shared context between your component and your network interface (Apollo Link).

                                                                                                                                                                                                                                                                                                                                                  property fetchPolicy

                                                                                                                                                                                                                                                                                                                                                  fetchPolicy?: FetchPolicy;
                                                                                                                                                                                                                                                                                                                                                  • How you want your component to interact with the Apollo cache. For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).

                                                                                                                                                                                                                                                                                                                                                  property onComplete

                                                                                                                                                                                                                                                                                                                                                  onComplete?: () => void;
                                                                                                                                                                                                                                                                                                                                                  • Allows the registration of a callback function that will be triggered each time the useSubscription Hook / Subscription component completes the subscription.

                                                                                                                                                                                                                                                                                                                                                    3.7.0

                                                                                                                                                                                                                                                                                                                                                  property onData

                                                                                                                                                                                                                                                                                                                                                  onData?: (options: OnDataOptions<TData>) => any;
                                                                                                                                                                                                                                                                                                                                                  • Allows the registration of a callback function that will be triggered each time the useSubscription Hook / Subscription component receives data. The callback options object param consists of the current Apollo Client instance in client, and the received subscription data in data.

                                                                                                                                                                                                                                                                                                                                                    3.7.0

                                                                                                                                                                                                                                                                                                                                                  property onError

                                                                                                                                                                                                                                                                                                                                                  onError?: (error: ApolloError) => void;
                                                                                                                                                                                                                                                                                                                                                  • Allows the registration of a callback function that will be triggered each time the useSubscription Hook / Subscription component receives an error.

                                                                                                                                                                                                                                                                                                                                                    3.7.0

                                                                                                                                                                                                                                                                                                                                                  property onSubscriptionComplete

                                                                                                                                                                                                                                                                                                                                                  onSubscriptionComplete?: () => void;
                                                                                                                                                                                                                                                                                                                                                  • Allows the registration of a callback function that will be triggered when the useSubscription Hook / Subscription component completes the subscription.

                                                                                                                                                                                                                                                                                                                                                    Deprecated

                                                                                                                                                                                                                                                                                                                                                    Use onComplete instead

                                                                                                                                                                                                                                                                                                                                                  property onSubscriptionData

                                                                                                                                                                                                                                                                                                                                                  onSubscriptionData?: (options: OnSubscriptionDataOptions<TData>) => any;
                                                                                                                                                                                                                                                                                                                                                  • Allows the registration of a callback function that will be triggered each time the useSubscription Hook / Subscription component receives data. The callback options object param consists of the current Apollo Client instance in client, and the received subscription data in subscriptionData.

                                                                                                                                                                                                                                                                                                                                                    Deprecated

                                                                                                                                                                                                                                                                                                                                                    Use onData instead

                                                                                                                                                                                                                                                                                                                                                  property shouldResubscribe

                                                                                                                                                                                                                                                                                                                                                  shouldResubscribe?:
                                                                                                                                                                                                                                                                                                                                                  | boolean
                                                                                                                                                                                                                                                                                                                                                  | ((options: BaseSubscriptionOptions<TData, TVariables>) => boolean);
                                                                                                                                                                                                                                                                                                                                                  • Determines if your subscription should be unsubscribed and subscribed again when an input to the hook (such as subscription or variables) changes.

                                                                                                                                                                                                                                                                                                                                                  property skip

                                                                                                                                                                                                                                                                                                                                                  skip?: boolean;
                                                                                                                                                                                                                                                                                                                                                  • Determines if the current subscription should be skipped. Useful if, for example, variables depend on previous queries and are not ready yet.

                                                                                                                                                                                                                                                                                                                                                  property variables

                                                                                                                                                                                                                                                                                                                                                  variables?: TVariables;
                                                                                                                                                                                                                                                                                                                                                  • An object containing all of the variables your subscription needs to execute

                                                                                                                                                                                                                                                                                                                                                  interface Context

                                                                                                                                                                                                                                                                                                                                                  interface DefaultContext extends Record<string, any> {}

                                                                                                                                                                                                                                                                                                                                                    interface DataProxy

                                                                                                                                                                                                                                                                                                                                                    interface DataProxy {}
                                                                                                                                                                                                                                                                                                                                                    • A proxy to the normalized data living in our store. This interface allows a user to read and write denormalized data which feels natural to the user whilst in the background this data is being converted into the normalized store format.

                                                                                                                                                                                                                                                                                                                                                    method readFragment

                                                                                                                                                                                                                                                                                                                                                    readFragment: <FragmentType, TVariables = any>(
                                                                                                                                                                                                                                                                                                                                                    options: DataProxy.ReadFragmentOptions<FragmentType, TVariables>,
                                                                                                                                                                                                                                                                                                                                                    optimistic?: boolean
                                                                                                                                                                                                                                                                                                                                                    ) => FragmentType | null;
                                                                                                                                                                                                                                                                                                                                                    • Reads a GraphQL fragment from any arbitrary id. If there is more than one fragment in the provided document then a fragmentName must be provided to select the correct fragment.

                                                                                                                                                                                                                                                                                                                                                    method readQuery

                                                                                                                                                                                                                                                                                                                                                    readQuery: <QueryType, TVariables = any>(
                                                                                                                                                                                                                                                                                                                                                    options: DataProxy.ReadQueryOptions<QueryType, TVariables>,
                                                                                                                                                                                                                                                                                                                                                    optimistic?: boolean
                                                                                                                                                                                                                                                                                                                                                    ) => QueryType | null;
                                                                                                                                                                                                                                                                                                                                                    • Reads a GraphQL query from the root query id.

                                                                                                                                                                                                                                                                                                                                                    method writeFragment

                                                                                                                                                                                                                                                                                                                                                    writeFragment: <TData = any, TVariables = any>(
                                                                                                                                                                                                                                                                                                                                                    options: DataProxy.WriteFragmentOptions<TData, TVariables>
                                                                                                                                                                                                                                                                                                                                                    ) => Reference | undefined;
                                                                                                                                                                                                                                                                                                                                                    • Writes a GraphQL fragment to any arbitrary id. If there is more than one fragment in the provided document then a fragmentName must be provided to select the correct fragment.

                                                                                                                                                                                                                                                                                                                                                    method writeQuery

                                                                                                                                                                                                                                                                                                                                                    writeQuery: <TData = any, TVariables = any>(
                                                                                                                                                                                                                                                                                                                                                    options: DataProxy.WriteQueryOptions<TData, TVariables>
                                                                                                                                                                                                                                                                                                                                                    ) => Reference | undefined;
                                                                                                                                                                                                                                                                                                                                                    • Writes a GraphQL query to the root query id.

                                                                                                                                                                                                                                                                                                                                                    interface DefaultContext

                                                                                                                                                                                                                                                                                                                                                    interface DefaultContext extends Record<string, any> {}

                                                                                                                                                                                                                                                                                                                                                      interface DefaultOptions

                                                                                                                                                                                                                                                                                                                                                      interface DefaultOptions {}

                                                                                                                                                                                                                                                                                                                                                        property mutate

                                                                                                                                                                                                                                                                                                                                                        mutate?: Partial<MutationOptions<any, any, any>>;

                                                                                                                                                                                                                                                                                                                                                          property query

                                                                                                                                                                                                                                                                                                                                                          query?: Partial<QueryOptions<any, any>>;

                                                                                                                                                                                                                                                                                                                                                            property watchQuery

                                                                                                                                                                                                                                                                                                                                                            watchQuery?: Partial<WatchQueryOptions<any, any>>;

                                                                                                                                                                                                                                                                                                                                                              interface DefaultOptions

                                                                                                                                                                                                                                                                                                                                                              interface DefaultOptions {}

                                                                                                                                                                                                                                                                                                                                                                property react

                                                                                                                                                                                                                                                                                                                                                                react?: {
                                                                                                                                                                                                                                                                                                                                                                suspense?: Readonly<SuspenseCacheOptions>;
                                                                                                                                                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                                                                                                                                                  interface ExecutionPatchIncrementalResult

                                                                                                                                                                                                                                                                                                                                                                  interface ExecutionPatchIncrementalResult<
                                                                                                                                                                                                                                                                                                                                                                  TData = Record<string, any>,
                                                                                                                                                                                                                                                                                                                                                                  TExtensions = Record<string, any>
                                                                                                                                                                                                                                                                                                                                                                  > extends ExecutionPatchResultBase {}

                                                                                                                                                                                                                                                                                                                                                                    property data

                                                                                                                                                                                                                                                                                                                                                                    data?: never;

                                                                                                                                                                                                                                                                                                                                                                      property errors

                                                                                                                                                                                                                                                                                                                                                                      errors?: never;

                                                                                                                                                                                                                                                                                                                                                                        property extensions

                                                                                                                                                                                                                                                                                                                                                                        extensions?: never;

                                                                                                                                                                                                                                                                                                                                                                          property incremental

                                                                                                                                                                                                                                                                                                                                                                          incremental?: IncrementalPayload<TData, TExtensions>[];

                                                                                                                                                                                                                                                                                                                                                                            interface ExecutionPatchInitialResult

                                                                                                                                                                                                                                                                                                                                                                            interface ExecutionPatchInitialResult<
                                                                                                                                                                                                                                                                                                                                                                            TData = Record<string, any>,
                                                                                                                                                                                                                                                                                                                                                                            TExtensions = Record<string, any>
                                                                                                                                                                                                                                                                                                                                                                            > extends ExecutionPatchResultBase {}

                                                                                                                                                                                                                                                                                                                                                                              property data

                                                                                                                                                                                                                                                                                                                                                                              data: TData | null | undefined;

                                                                                                                                                                                                                                                                                                                                                                                property errors

                                                                                                                                                                                                                                                                                                                                                                                errors?: ReadonlyArray<GraphQLError>;

                                                                                                                                                                                                                                                                                                                                                                                  property extensions

                                                                                                                                                                                                                                                                                                                                                                                  extensions?: TExtensions;

                                                                                                                                                                                                                                                                                                                                                                                    property incremental

                                                                                                                                                                                                                                                                                                                                                                                    incremental?: never;

                                                                                                                                                                                                                                                                                                                                                                                      interface FetchMoreOptions

                                                                                                                                                                                                                                                                                                                                                                                      interface FetchMoreOptions<TData = any, TVariables = OperationVariables> {}

                                                                                                                                                                                                                                                                                                                                                                                        property updateQuery

                                                                                                                                                                                                                                                                                                                                                                                        updateQuery?: (
                                                                                                                                                                                                                                                                                                                                                                                        previousQueryResult: TData,
                                                                                                                                                                                                                                                                                                                                                                                        options: {
                                                                                                                                                                                                                                                                                                                                                                                        fetchMoreResult?: TData;
                                                                                                                                                                                                                                                                                                                                                                                        variables?: TVariables;
                                                                                                                                                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                                                                                                                                                        ) => TData;

                                                                                                                                                                                                                                                                                                                                                                                          interface FetchMoreQueryOptions

                                                                                                                                                                                                                                                                                                                                                                                          interface FetchMoreQueryOptions<TVariables, TData = any> {}

                                                                                                                                                                                                                                                                                                                                                                                            property context

                                                                                                                                                                                                                                                                                                                                                                                            context?: DefaultContext;

                                                                                                                                                                                                                                                                                                                                                                                              property query

                                                                                                                                                                                                                                                                                                                                                                                              query?: DocumentNode | TypedDocumentNode<TData, TVariables>;
                                                                                                                                                                                                                                                                                                                                                                                              • A GraphQL query string parsed into an AST with the gql template literal.

                                                                                                                                                                                                                                                                                                                                                                                                1. Operation options

                                                                                                                                                                                                                                                                                                                                                                                              property variables

                                                                                                                                                                                                                                                                                                                                                                                              variables?: Partial<TVariables>;
                                                                                                                                                                                                                                                                                                                                                                                              • An object containing all of the GraphQL variables your query requires to execute.

                                                                                                                                                                                                                                                                                                                                                                                                Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value.

                                                                                                                                                                                                                                                                                                                                                                                                1. Operation options

                                                                                                                                                                                                                                                                                                                                                                                              interface FieldFunctionOptions

                                                                                                                                                                                                                                                                                                                                                                                              interface FieldFunctionOptions<
                                                                                                                                                                                                                                                                                                                                                                                              TArgs = Record<string, any>,
                                                                                                                                                                                                                                                                                                                                                                                              TVars = Record<string, any>
                                                                                                                                                                                                                                                                                                                                                                                              > {}

                                                                                                                                                                                                                                                                                                                                                                                                property args

                                                                                                                                                                                                                                                                                                                                                                                                args: TArgs | null;

                                                                                                                                                                                                                                                                                                                                                                                                  property cache

                                                                                                                                                                                                                                                                                                                                                                                                  cache: InMemoryCache;

                                                                                                                                                                                                                                                                                                                                                                                                    property canRead

                                                                                                                                                                                                                                                                                                                                                                                                    canRead: CanReadFunction;

                                                                                                                                                                                                                                                                                                                                                                                                      property field

                                                                                                                                                                                                                                                                                                                                                                                                      field: FieldNode | null;

                                                                                                                                                                                                                                                                                                                                                                                                        property fieldName

                                                                                                                                                                                                                                                                                                                                                                                                        fieldName: string;

                                                                                                                                                                                                                                                                                                                                                                                                          property isReference

                                                                                                                                                                                                                                                                                                                                                                                                          isReference: typeof isReference;

                                                                                                                                                                                                                                                                                                                                                                                                            property mergeObjects

                                                                                                                                                                                                                                                                                                                                                                                                            mergeObjects: MergeObjectsFunction;

                                                                                                                                                                                                                                                                                                                                                                                                              property readField

                                                                                                                                                                                                                                                                                                                                                                                                              readField: ReadFieldFunction;

                                                                                                                                                                                                                                                                                                                                                                                                                property storage

                                                                                                                                                                                                                                                                                                                                                                                                                storage: StorageType;

                                                                                                                                                                                                                                                                                                                                                                                                                  property storeFieldName

                                                                                                                                                                                                                                                                                                                                                                                                                  storeFieldName: string;

                                                                                                                                                                                                                                                                                                                                                                                                                    property toReference

                                                                                                                                                                                                                                                                                                                                                                                                                    toReference: ToReferenceFunction;

                                                                                                                                                                                                                                                                                                                                                                                                                      property variables

                                                                                                                                                                                                                                                                                                                                                                                                                      variables?: TVars;

                                                                                                                                                                                                                                                                                                                                                                                                                        interface GraphQLRequest

                                                                                                                                                                                                                                                                                                                                                                                                                        interface GraphQLRequest<TVariables = Record<string, any>> {}

                                                                                                                                                                                                                                                                                                                                                                                                                          property context

                                                                                                                                                                                                                                                                                                                                                                                                                          context?: DefaultContext;

                                                                                                                                                                                                                                                                                                                                                                                                                            property extensions

                                                                                                                                                                                                                                                                                                                                                                                                                            extensions?: Record<string, any>;

                                                                                                                                                                                                                                                                                                                                                                                                                              property operationName

                                                                                                                                                                                                                                                                                                                                                                                                                              operationName?: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                property query

                                                                                                                                                                                                                                                                                                                                                                                                                                query: DocumentNode;

                                                                                                                                                                                                                                                                                                                                                                                                                                  property variables

                                                                                                                                                                                                                                                                                                                                                                                                                                  variables?: TVariables;

                                                                                                                                                                                                                                                                                                                                                                                                                                    interface HttpOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                    interface HttpOptions {}

                                                                                                                                                                                                                                                                                                                                                                                                                                      property credentials

                                                                                                                                                                                                                                                                                                                                                                                                                                      credentials?: string;
                                                                                                                                                                                                                                                                                                                                                                                                                                      • The credentials policy you want to use for the fetch call.

                                                                                                                                                                                                                                                                                                                                                                                                                                      property fetch

                                                                                                                                                                                                                                                                                                                                                                                                                                      fetch?: typeof fetch;
                                                                                                                                                                                                                                                                                                                                                                                                                                      • A fetch-compatible API to use when making requests.

                                                                                                                                                                                                                                                                                                                                                                                                                                      property fetchOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                      fetchOptions?: any;
                                                                                                                                                                                                                                                                                                                                                                                                                                      • Any overrides of the fetch options argument to pass to the fetch call.

                                                                                                                                                                                                                                                                                                                                                                                                                                      property headers

                                                                                                                                                                                                                                                                                                                                                                                                                                      headers?: Record<string, string>;
                                                                                                                                                                                                                                                                                                                                                                                                                                      • An object representing values to be sent as headers on the request.

                                                                                                                                                                                                                                                                                                                                                                                                                                      property includeExtensions

                                                                                                                                                                                                                                                                                                                                                                                                                                      includeExtensions?: boolean;
                                                                                                                                                                                                                                                                                                                                                                                                                                      • Passes the extensions field to your graphql server.

                                                                                                                                                                                                                                                                                                                                                                                                                                        Defaults to false.

                                                                                                                                                                                                                                                                                                                                                                                                                                      property includeUnusedVariables

                                                                                                                                                                                                                                                                                                                                                                                                                                      includeUnusedVariables?: boolean;
                                                                                                                                                                                                                                                                                                                                                                                                                                      • If set to true, the default behavior of stripping unused variables from the request will be disabled.

                                                                                                                                                                                                                                                                                                                                                                                                                                        Unused variables are likely to trigger server-side validation errors, per https://spec.graphql.org/draft/#sec-All-Variables-Used, but this includeUnusedVariables option can be useful if your server deviates from the GraphQL specification by not strictly enforcing that rule.

                                                                                                                                                                                                                                                                                                                                                                                                                                      property preserveHeaderCase

                                                                                                                                                                                                                                                                                                                                                                                                                                      preserveHeaderCase?: boolean;
                                                                                                                                                                                                                                                                                                                                                                                                                                      • If set to true, header names won't be automatically normalized to lowercase. This allows for non-http-spec-compliant servers that might expect capitalized header names.

                                                                                                                                                                                                                                                                                                                                                                                                                                      property print

                                                                                                                                                                                                                                                                                                                                                                                                                                      print?: Printer;
                                                                                                                                                                                                                                                                                                                                                                                                                                      • A function to substitute for the default query print function. Can be used to apply changes to the results of the print function.

                                                                                                                                                                                                                                                                                                                                                                                                                                      property uri

                                                                                                                                                                                                                                                                                                                                                                                                                                      uri?: string | UriFunction;
                                                                                                                                                                                                                                                                                                                                                                                                                                      • The URI to use when fetching operations.

                                                                                                                                                                                                                                                                                                                                                                                                                                        Defaults to '/graphql'.

                                                                                                                                                                                                                                                                                                                                                                                                                                      property useGETForQueries

                                                                                                                                                                                                                                                                                                                                                                                                                                      useGETForQueries?: boolean;
                                                                                                                                                                                                                                                                                                                                                                                                                                      • If set to true, use the HTTP GET method for query operations. Mutations will still use the method specified in fetchOptions.method (which defaults to POST).

                                                                                                                                                                                                                                                                                                                                                                                                                                      interface IdGetterObj

                                                                                                                                                                                                                                                                                                                                                                                                                                      interface IdGetterObj extends Object {}

                                                                                                                                                                                                                                                                                                                                                                                                                                        property id

                                                                                                                                                                                                                                                                                                                                                                                                                                        id?: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                          interface IDocumentDefinition

                                                                                                                                                                                                                                                                                                                                                                                                                                          interface IDocumentDefinition {}

                                                                                                                                                                                                                                                                                                                                                                                                                                            property name

                                                                                                                                                                                                                                                                                                                                                                                                                                            name: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                              property type

                                                                                                                                                                                                                                                                                                                                                                                                                                              type: DocumentType;

                                                                                                                                                                                                                                                                                                                                                                                                                                                property variables

                                                                                                                                                                                                                                                                                                                                                                                                                                                variables: ReadonlyArray<VariableDefinitionNode>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                  interface IncrementalPayload

                                                                                                                                                                                                                                                                                                                                                                                                                                                  interface IncrementalPayload<TData, TExtensions> {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                    property data

                                                                                                                                                                                                                                                                                                                                                                                                                                                    data: TData | null;

                                                                                                                                                                                                                                                                                                                                                                                                                                                      property errors

                                                                                                                                                                                                                                                                                                                                                                                                                                                      errors?: ReadonlyArray<GraphQLError>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                        property extensions

                                                                                                                                                                                                                                                                                                                                                                                                                                                        extensions?: TExtensions;

                                                                                                                                                                                                                                                                                                                                                                                                                                                          property label

                                                                                                                                                                                                                                                                                                                                                                                                                                                          label?: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                            property path

                                                                                                                                                                                                                                                                                                                                                                                                                                                            path: Path;

                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface InMemoryCacheConfig

                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface InMemoryCacheConfig extends ApolloReducerConfig {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                property canonizeResults

                                                                                                                                                                                                                                                                                                                                                                                                                                                                canonizeResults?: boolean;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Deprecated

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Using canonizeResults can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                property fragments

                                                                                                                                                                                                                                                                                                                                                                                                                                                                fragments?: FragmentRegistryAPI;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property possibleTypes

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  possibleTypes?: PossibleTypesMap;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property resultCacheMaxSize

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    resultCacheMaxSize?: number;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Deprecated

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Please use cacheSizes instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property resultCaching

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    resultCaching?: boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property typePolicies

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      typePolicies?: TypePolicies;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface InternalRefetchQueriesOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface InternalRefetchQueriesOptions<TCache extends ApolloCache<any>, TResult>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        extends Omit<RefetchQueriesOptions<TCache, TResult>, 'include'> {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property include

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          include?: InternalRefetchQueriesInclude;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property removeOptimistic

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            removeOptimistic?: string;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface LazyQueryHookExecOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface LazyQueryHookExecOptions<
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              TData = any,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              TVariables extends OperationVariables = OperationVariables
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              > extends LazyQueryHookOptions<TData, TVariables> {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property query

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                query?: DocumentNode | TypedDocumentNode<TData, TVariables>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  interface LazyQueryHookOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  interface LazyQueryHookOptions<
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  TData = any,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  TVariables extends OperationVariables = OperationVariables
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  > extends BaseQueryOptions<TVariables, TData> {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property onCompleted

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    onCompleted?: (data: TData) => void;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • A callback function that's called when your query successfully completes with zero errors (or if errorPolicy is ignore and partial data is returned).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      This function is passed the query's result data.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1. Operation options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property onError

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    onError?: (error: ApolloError) => void;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • A callback function that's called when the query encounters one or more errors (unless errorPolicy is ignore).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      This function is passed an ApolloError object that contains either a networkError object or a graphQLErrors array, depending on the error(s) that occurred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1. Operation options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface LoadableQueryHookOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface LoadableQueryHookOptions {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property canonizeResults

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      canonizeResults?: boolean;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Whether to canonize cache results before returning them. Canonization takes some extra time, but it speeds up future deep equality comparisons. Defaults to false.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Deprecated

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Using canonizeResults can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property client

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      client?: ApolloClient<any>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • The instance of ApolloClient to use to execute the query.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        By default, the instance that's passed down via context is used, but you can provide a different instance here.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        1. Operation options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property context

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      context?: DefaultContext;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the context object that's passed along your link chain.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        2. Networking options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property errorPolicy

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      errorPolicy?: ErrorPolicy;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Specifies how the query handles a response that returns both GraphQL errors and partial results.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The default value is none, meaning that the query result includes error details but not partial results.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        1. Operation options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property fetchPolicy

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      fetchPolicy?: LoadableQueryHookFetchPolicy;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The default value is cache-first.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        3. Caching options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property queryKey

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      queryKey?: string | number | any[];
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • A unique identifier for the query. Each item in the array must be a stable identifier to prevent infinite fetches.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        This is useful when using the same query and variables combination in more than one component, otherwise the components may clobber each other. This can also be used to force the query to re-evaluate fresh.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        1. Operation options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property refetchWritePolicy

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      refetchWritePolicy?: RefetchWritePolicy;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Specifies whether a NetworkStatus.refetch operation should merge incoming field data with existing data, or overwrite the existing data. Overwriting is probably preferable, but merging is currently the default behavior, for backwards compatibility with Apollo Client 3.x.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        3. Caching options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property returnPartialData

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      returnPartialData?: boolean;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • If true, the query can return partial results from the cache if the cache doesn't contain results for all queried fields.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The default value is false.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        3. Caching options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      interface MergeInfo

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      interface MergeInfo {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        property field

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        field: FieldNode;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property merge

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          merge: FieldMergeFunction;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            property typename

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            typename: string | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface MergeTree

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface MergeTree {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property info

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                info?: MergeInfo;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property map

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  map: Map<string | number, MergeTree>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface MutationDataOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    interface MutationDataOptions<
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    TData = any,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    TVariables = OperationVariables,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    TContext = DefaultContext,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    TCache extends ApolloCache<any> = ApolloCache<any>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    > extends BaseMutationOptions<TData, TVariables, TContext, TCache> {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      property mutation

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface MutationFunctionOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface MutationFunctionOptions<
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        TData = any,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        TVariables = OperationVariables,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        TContext = DefaultContext,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        TCache extends ApolloCache<any> = ApolloCache<any>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        > extends BaseMutationOptions<TData, TVariables, TContext, TCache> {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          property mutation

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          mutation?: DocumentNode | TypedDocumentNode<TData, TVariables>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • A GraphQL document, often created with gql from the graphql-tag package, that contains a single mutation inside of it.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1. Operation options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          interface MutationHookOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          interface MutationHookOptions<
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          TData = any,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          TVariables = OperationVariables,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          TContext = DefaultContext,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          TCache extends ApolloCache<any> = ApolloCache<any>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          > extends BaseMutationOptions<TData, TVariables, TContext, TCache> {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface MutationOptions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            interface MutationOptions<
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            TData = any,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            TVariables = OperationVariables,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            TContext = DefaultContext,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            TCache extends ApolloCache<any> = ApolloCache<any>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            > extends MutationSharedOptions<TData, TVariables, TContext, TCache> {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              property mutation

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • A GraphQL document, often created with gql from the graphql-tag package, that contains a single mutation inside of it.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                1. Operation options

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface MutationResult

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              interface MutationResult<TData = any> {}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property called

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                called: boolean;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • If true, the mutation's mutate function has been called.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property client

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                client: ApolloClient<object>;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • The instance of Apollo Client that executed the mutation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Can be useful for manually executing followup operations or writing data to the cache.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property data

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                data?: TData | null;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • The data returned from your mutation. Can be undefined if ignoreResults is true.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                error?: ApolloError;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • If the mutation produces one or more errors, this object contains either an array of graphQLErrors or a single networkError. Otherwise, this value is undefined.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property loading

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                loading: boolean;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • If true, the mutation is currently in flight.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                method reset

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                reset: () => void;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • A function that you can call to reset the mutation's result to its initial, uncalled state.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                interface NormalizedCache

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                interface NormalizedCache {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • This is an interface used to access, set and remove StoreObjects from the cache

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                property canRead

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                canRead: CanReadFunction;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  property getFieldValue

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  getFieldValue: FieldValueGetter;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    property toReference

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    toReference: ToReferenceFunction;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      method clear

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      clear: () => void;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        method delete

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        delete: (dataId: string, fieldName?: string) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          method get

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          get: (dataId: string, fieldName: string) => StoreValue;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            method getStorage

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            getStorage: (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            idOrObj: string | StoreObject,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ...storeFieldNames: (string | number)[]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ) => StorageType;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              method has

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              has: (dataId: string) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                method merge

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                merge: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (olderId: string, newerObject: StoreObject): void;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (olderObject: StoreObject, newerId: string): void;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  method modify

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  modify: <Entity extends Record<string, any>>(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  dataId: string,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  fields: Modifiers<Entity> | AllFieldsModifier<Entity>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ) => boolean;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    method release

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    release: (rootId: string) => number;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      method replace

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      replace: (newData: NormalizedCacheObject) => void;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • replace the state of the store

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      method retain

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      retain: (rootId: string) => number;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Retain (or release) a given root ID to protect (or expose) it and its transitive child entities from (or to) garbage collection. The current retainment count is returned by both methods. Note that releasing a root ID does not cause that entity to be garbage collected, but merely removes it from the set of root IDs that will be considered during the next mark-and-sweep collection.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      method toObject

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      toObject: () => NormalizedCacheObject;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • returns an Object with key-value pairs matching the contents of the store

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      interface NormalizedCacheObject

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      interface NormalizedCacheObject {}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • This is a normalized representation of the Apollo query result cache. It consists of a flattened representation of query result trees.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      index signature

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [dataId: string]: StoreObject | undefined;

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface ObservableQueryFields

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        interface