Apollo Client is a comprehensive GraphQL client for JavaScript applications, providing caching, state management, and integrations with React, Angular, Vue, and other frameworks. The current stable version is 4.1.9 (2025-01-14), with a legacy v2.6.10 still in use. Major versions have breaking changes: v3 introduced a new package structure (@apollo/client), removed the separate apollo-boost preset, and switched to a single combined package. v4 (alpha) introduces modern method signatures. Key differentiators: normalized in-memory cache, optimistic UI, pagination helpers, and developer tools. It requires a GraphQL schema and is compatible with any GraphQL server. Release cadence is rapid with frequent patches.
npm install apollo-clientVerified import paths — ran on the pinned version, not inferred.
Creates an Apollo Client instance with a GraphQL endpoint and in-memory cache, then executes a query.
Replace imports from 'apollo-client' etc. with '@apollo/client'. Update dependencies accordingly.
Change `import ApolloClient from 'apollo-client'` to `import { ApolloClient } from '@apollo/client'`.Use `import { useQuery } from '@apollo/client'` instead of `import { useQuery } from 'react-apollo'`.Upgrade to @apollo/client@4.1.5 or later, or manage polling manually with skip logic.
Upgrade to @apollo/client@4.1.4+ or implement custom merge logic.
Wrap your app with <ApolloProvider client={client}> or pass client directly to useQuery.Check network connectivity, ensure the GraphQL endpoint is correct, and handle loading/error states.
Provide a dataIdFromObject function in the cache constructor or use typePolicies for normalization.
Install @apollo/client and update imports to `import { ApolloClient } from '@apollo/client'`.Install @apollo/client instead and configure manually: `npm uninstall apollo-boost && npm install @apollo/client graphql`.