Creative & DesignIntermediate
apollo-client
Build React applications with Apollo Client 4
Developer Setup
Setup & Installation
bash
npx skills add https://github.com/apollographql/skills --skill apollo-clientnpx skills add https://github.com/apollographql/skills --skill apollo-clientOr paste this URL into your assistant to install:
Overview
What This Skill Does
Build React applications with Apollo Client 4
Application
When to use this Skill
- Integrating apollo client into your development workflow.
- Following best practices for build react applications with apollo client 4.
- Automating repetitive tasks with AI-assisted tooling.
- Building production-grade applications with proper standards.
- Debugging and troubleshooting common implementation issues.
Documentation
Show Skills.md file
Apollo Client 4.x Guide
Apollo Client is a comprehensive state management library for JavaScript that enables you to manage both local and remote data with GraphQL. Version 4.x brings improved caching, better TypeScript support, and React 19 compatibility.
Integration Guides
Choose the integration guide that matches your application setup:
- Client-Side Apps - For client-side React applications without SSR (Vite, Create React App, etc.)
- Next.js App Router - For Next.js applications using the App Router with React Server Components
- React Router Framework Mode - For React Router 7 applications with streaming SSR
- TanStack Start - For TanStack Start applications with modern routing
Each guide includes installation steps, configuration, and framework-specific patterns optimized for that environment.
Quick Reference
Basic Query
import { gql } from "@apollo/client";
import { useQuery } from "@apollo/client/react";
const GET_USER = gql`
query GetUser($id: ID!) {
user(id: $id) {
id
name
}
}
`;
function UserProfile({ userId }: { userId: string }) {
const { loading, error, data, dataState } = useQuery(GET_USER, {
variables: { id: userId },
});
if (loading) return <p>Loading...</p>;
if (error) return <p>Error: {error.message}</p>;
// TypeScript note: for stricter type narrowing, you can also check `dataState === "complete"` before accessing data
return <div>{data?.user.name}</div>;
}
Lines 1 - 44 of 151
Recommendations