Guide for building React applications with Apollo Client 4.x. Use this skill when: (1) setting up Apollo Client in a React project, (2) writing GraphQL queries or mutations with hooks, (3) configuring caching or cache policies, (4) managing local state with reactive variables, (5) troubleshooting Apollo Client errors or performance issues.
Detected risks:
The apollo-client skill provides comprehensive guidance for integrating and using Apollo Client 4.x in React applications. It helps developers efficiently manage both local and remote data via GraphQL, offering a robust solution for state management in modern React projects. By leveraging this skill, developers can streamline data fetching, caching, and state updates, reducing the complexity of handling asynchronous GraphQL operations and improving application performance and maintainability.
Apollo Client 4.x brings several key features and enhancements. It supports improved caching strategies and cache policies, providing fine-grained control over how data is stored and updated. The skill covers the use of GraphQL queries and mutations with React hooks, including basic usage, Suspense-based data fetching, and TypeScript support for type-safe operations. It also guides developers in managing local state through reactive variables, integrating seamlessly with React frameworks such as Next.js, Vite, Create React App, and React Router. The skill includes references to detailed documentation on fragments, caching, and state management, as well as best practices for error handling and performance optimization.
This skill is particularly useful for React developers building applications that rely on GraphQL APIs and require efficient state management. Typical use cases include client-side data fetching, server-side rendering with React Server Components, and implementing reactive UI updates based on local and remote data changes. Target users include developers looking to adopt Apollo Client for modern React projects, those needing guidance on caching and TypeScript integration, and teams aiming to troubleshoot or optimize Apollo Client usage in their applications.
Apollo Client 4.x is compatible with React 18+ and React 19, including support for Suspense and React Server Components.
Yes, it works with Next.js, Vite, Create React App, and other React frameworks. Integration guides are available for different setups.
You can use the `useQuery` hook from @apollo/client/react along with a `gql` query definition to fetch data, handle loading and error states, and access the result in your component.
Yes, it includes improved TypeScript support and provides guidance for GraphQL code generation to ensure type-safe operations.
Suspense queries require React components that can handle Suspense boundaries. Apollo Client provides `useSuspenseQuery` and related hooks, but these require wrapping the consuming component in a `Suspense` component with a fallback UI.
Quick Setup:
.claude/skills/Repository
apollographql/skills