@tanstack/react-query vs xstate
@tanstack/react-query is downloaded 11.1× more often than xstate (225,327,948 vs 20,263,809 per month), so it has the larger community and more answered questions online. Both projects are actively maintained.
| Metric | @tanstack/react-query | xstate |
|---|---|---|
| Weekly downloads | 51,850,189✓ | 4,469,231 |
| Monthly downloads | 225,327,948✓ | 20,263,809 |
| GitHub stars | 49,542✓ | 29,666 |
| Minified size | 45.1 kB | 44.7 kB✓ |
| Minified + gzipped | 13.3 kB✓ | 14.1 kB |
| Dependencies | 1 | 0✓ |
| Open issues | 172 | 123✓ |
| Last commit | 2026-06-02✓ | 2026-06-01 |
| Latest version | 5.100.14 | 5.32.0 |
| License | MIT | MIT |
When to choose which
@tanstack/react-query
Async server-state: caching, refetching and mutations.
Choose it when: Managing data from an API — caching, background refetch, pagination, mutations. It complements (not replaces) a client store.
- + Best-in-class server cache
- + Great devtools
- + Handles refetch/stale data
- - Not for client/UI state
- - More config than SWR
xstate
Explicit state machines and statecharts.
Choose it when: Complex flows (wizards, async sequences, UI with many states) where you want logic that is explicit, testable and visualizable.
- + Impossible states become impossible
- + Visualizable logic
- + Framework-agnostic
- - Steepest learning curve here
- - Overkill for simple state
Feature comparison
| Feature | @tanstack/react-query | xstate |
|---|---|---|
| Paradigm | Async server cache | State machines |
| First-class TypeScript | ✓ Yes | ✓ Yes |
| Works outside React | Partial | ✓ Yes |
| Dedicated devtools | ✓ Yes | ✓ Yes |
| Built-in async / server state | ✓ Yes | ✓ Yes |
| Boilerplate | Low | High |
@tanstack/react-query
Hooks for managing, caching and syncing asynchronous and remote data in React
Related comparisons
Embed this comparison
A live badge for your README — it updates as the numbers change.
[](https://devcompare.dev/compare/tanstack-react-query-vs-xstate)Data from npm, Bundlephobia and GitHub. Last updated 2026-06-02.