Apollo Client (Web)
IntroductionWhy Apollo Client?Get started
Core concepts
Caching
Pagination
Local State
Development & Testing
Performance
Integrations
Networking
API Reference
ChangelogMigrating to Apollo Client 4.0Versioning Policy

useApolloClient

Apollo Client API reference


Example

JavaScript
1 import { useApolloClient } from "@apollo/client/react";
2
3 function SomeComponent() {
4   const client = useApolloClient();
5   // `client` is now set to the `ApolloClient` instance being used by the
6   // application (that was configured using something like `ApolloProvider`)
7 }

Signature

TypeScript
1useApolloClient(
2  override?: ApolloClient
3): ApolloClient
(src/react/hooks/useApolloClient.ts)

Parameters

Name / Type
Description

Result

The `ApolloClient` instance being used by the application.
ApolloClient