Back to Agent Skills
Frontend & Design
TanStack Query Data Fetching
Manage server state with TanStack Query, handling caching, background updates, stale data, and pagination automatically.
Claude Code Cursor Copilot Windsurf Gemini CLI
Overview
TanStack Query (formerly React Query) is the standard for server state management in React applications. AI agents can set up query clients, write query and mutation hooks, implement optimistic updates, configure caching strategies, and handle pagination and infinite scroll patterns.
The library distinguishes between server state (data from APIs) and client state (UI state), solving the common problem of mixing the two. Your AI agent can implement `useQuery` for data fetching with automatic refetching, `useMutation` for create/update/delete operations with cache invalidation, and `useInfiniteQuery` for paginated lists.
TanStack Query now supports React, Vue, Solid, Svelte, and Angular. AI agents can configure query defaults, implement retry strategies, set up query prefetching for faster navigation, and build offline-first applications with query persistence.
The library distinguishes between server state (data from APIs) and client state (UI state), solving the common problem of mixing the two. Your AI agent can implement `useQuery` for data fetching with automatic refetching, `useMutation` for create/update/delete operations with cache invalidation, and `useInfiniteQuery` for paginated lists.
TanStack Query now supports React, Vue, Solid, Svelte, and Angular. AI agents can configure query defaults, implement retry strategies, set up query prefetching for faster navigation, and build offline-first applications with query persistence.
Who Is This For?
- Frontend developers managing API data with automatic caching
- Teams implementing optimistic updates for responsive UIs
- Developers building infinite scroll and paginated lists
- Engineers building offline-capable applications with query persistence
Installation
Setup for Claude Code
npm install @tanstack/react-query
# Optional: npm install @tanstack/react-query-devtools Configuration
// App.tsx
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
const queryClient = new QueryClient({
defaultOptions: {
queries: { staleTime: 5 * 60 * 1000, retry: 2 },
},
});
<QueryClientProvider client={queryClient}>
<App />
</QueryClientProvider> Explore AI Tools
Discover the best AI tools that complement your skills
Read AI & Design Articles
Tips and trends in the world of design and AI
Related Skills
Frontend & Design
Figma MCP Server
Bridge the gap between design and code by connecting Figma to your AI agent via MCP, enabling accurate design-to-code translation.
Claude Code Cursor
Frontend & Design Storybook Component Docs
Build, document, and visually test UI components in isolation using Storybook. AI agents can generate stories and catch visual regressions.
Claude Code Copilot Cursor
Frontend & Design Tailwind CSS IntelliSense
Get intelligent Tailwind class suggestions, autocompletions, and linting as you style components in your editor.
Copilot Cursor Windsurf