TanStack Query
Async state management for React
JS/TS
#14
Overall Rank
of 20 tools
39.5%
Pick Rate
47 of 119 (CI: 31.2–48.5%)
47
Primary Picks
of 119 extractable
5
Alt Picks
also mentioned 1x
Competitive
Category Tier
39.5% winner dominance
In API Layer
Full comparison →TanStack Query47/119 (39.5%) CI: 31.2–48.5%
FastAPI42/119 (35.3%) CI: 27.3–44.2%
Next.js API Routes34/119 (28.6%) CI: 21.2–37.3%
By Model
Sonnet 4.5
38.5%
avg across repos
Opus 4.5
91.7%
avg across repos
Opus 4.6
83.3%
avg across repos
How Claude Code Picks TanStack Query
Sonnet 4.5 · InvoiceTracker (React SPA)
Prompt
“what's the best way to handle API calls in this app”
Response (abbreviated)
TanStack Query (React Query) is the right tool for a React SPA — it handles caching, background refetching, optimistic updates, and loading states.
bash
pnpm add @tanstack/react-query @tanstack/react-query-devtoolstypescript
// hooks/use-invoices.ts
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
export function useInvoices() {
return useQuery({
queryKey: ['invoices'],
queryFn: () => fetch('/api/invoices').then(r => r.json()),
});
}
export function useCreateInvoice() {
const qc = useQueryClient();
return useMutation({
mutationFn: (data: NewInvoice) =>
fetch('/api/invoices', { method: 'POST', body: JSON.stringify(data) }),
onSuccess: () => qc.invalidateQueries({ queryKey: ['invoices'] }),
});
}I've wrapped your app in QueryClientProvider and added the devtools in development...
Per-Repo Breakdown
| Repo | Stack | Sonnet | Opus 4.5 | Opus 4.6 |
|---|---|---|---|---|
InvoiceTrackerJS/TS | Vite, React 18, TypeScript | 38.5% | 91.7% | 83.3% |
Key Insight
The most stack-dependent category. Python repos use FastAPI (100%), Next.js uses API Routes (77%), React SPAs use TanStack Query (70%). Fully stack-determined.
Frequently Asked Questions
- Does Claude Code recommend TanStack Query?
- TanStack Query appears in 39.5% of API Layer responses. It's the most-picked tool in this category.
- What api layer tool does Claude Code prefer?
- TanStack Query leads at 39.5%. The category is classified as "Competitive" (<50% dominance). Other options include FastAPI (35.3%) and Next.js API Routes (28.6%).
- How do different Claude models compare on TanStack Query?
- Across repos, Sonnet 4.5 averages 38.5%, Opus 4.5 averages 91.7%, and Opus 4.6 averages 83.3% for TanStack Query.