TanStack Query vs SWR
In 4,864 JavaScript/TypeScript projects set up for AI coding agents, TanStack Query is a dependency in 460 (9.5%) and SWR in 50 (1.0%): TanStack Query is 9.2× as common. Among repos created in the last 90 days that use a state and data fetching tool, TanStack Query is in 35.0% and SWR in 2.5%, against 44.5% and 4.9% of older ones. 13 projects list both, often a sign of a migration or of a monorepo with several apps.
State and data fetching npm Updated Nov 17, 2026
| TanStack Query | 9.5% | |
|---|---|---|
| SWR | 1.0% |
Share of 4,864 JavaScript/TypeScript projects set up for AI coding agents that list each one as a dependency.
Side by side
| TanStack Query | SWR | |
|---|---|---|
| Agent projects that use it | 460 | 50 |
| Rank in state and data fetching | #1 | #5 |
| In new repos with a state and data fetching tool (last 90 days) | 35.0% | 2.5% |
| In older repos with one | 44.5% | 4.9% |
| Downloads, last 7 days | 86.6M | 27.2M |
| GitHub stars | 50.6K | 32.5K |
| Last push to its repo | Nov 17, 2026 | Oct 16, 2026 |
| License | MIT | MIT |
| Funding | — | — |
| Projects that list both | 13 | |
Downloads include CI runs and installs as a dependency of other packages. Stars and pushes are from GitHub's API; downloads from npm.
By coding agent
| Projects set up for | JavaScript/TypeScript repos | TanStack Query | SWR |
|---|---|---|---|
| Claude Code | 2,617 | 8.8% | 1.0% |
| GitHub Copilot | 2,350 | 8.4% | 0.7% |
| Cursor | 1,990 | 12.2% | 1.6% |
| Gemini CLI | 422 | 6.9% | 0% |
| OpenAI Codex | 409 | 9.8% | 0% |
| OpenCode | 304 | 8.9% | 0% |
| OpenClaw | 241 | 3.7% | 0% |
| Devin Desktop | 231 | 13.0% | 0% |
| Kiro | 125 | 8.0% | 0% |
| Roo-Code | 90 | 17.8% | 0% |
Share of the JavaScript/TypeScript repos configured for each agent (its config file in the repo) that list the tool. A repo set up for two agents counts for both.
TanStack Query
Hooks for managing, caching and synchronizing remote data in React.
Most often used with it:
| Lucide React | 77.6% of its projects |
|---|---|
| Tailwind Merge | 75.0% of its projects |
| clsx | 76.5% of its projects |
| React | 98.5% of its projects |
| Class Variance Authority | 70.4% of its projects |
npm install @tanstack/react-query
SWR
React hooks library for data fetching with caching, revalidation and real-time updates.
Most often used with it:
| Next.js | 88.0% of its projects |
|---|---|
| Lucide React | 80.0% of its projects |
| clsx | 78.0% of its projects |
| React | 100.0% of its projects |
| Tailwind Merge | 74.0% of its projects |
npm install swr
How we count
Projects are public GitHub repos our weekly scan finds through coding-agent config files (CLAUDE.md, AGENTS.md, .cursor/mcp.json and others); a project uses a tool when its package.json, requirements.txt or pyproject.toml lists it. "Same job" was checked for every pair, so add-ons and companions are never paired. Shares by repo age compare repos created in the last 90 days with older ones in the same scan. More on the method.