@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-queryxstate
Weekly downloads51,850,1894,469,231
Monthly downloads225,327,94820,263,809
GitHub stars49,54229,666
Minified size45.1 kB44.7 kB
Minified + gzipped13.3 kB14.1 kB
Dependencies10
Open issues172123
Last commit2026-06-022026-06-01
Latest version5.100.145.32.0
LicenseMITMIT

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-queryxstate
ParadigmAsync server cacheState machines
First-class TypeScript✓ Yes✓ Yes
Works outside ReactPartial✓ Yes
Dedicated devtools✓ Yes✓ Yes
Built-in async / server state✓ Yes✓ Yes
BoilerplateLowHigh

@tanstack/react-query

Hooks for managing, caching and syncing asynchronous and remote data in React

xstate

Finite State Machines and Statecharts for the Modern Web.

Related comparisons

Embed this comparison

A live badge for your README — it updates as the numbers change.

@tanstack/react-query vs xstate downloads
[![@tanstack/react-query vs xstate](https://devcompare.dev/badge/tanstack-react-query-vs-xstate.svg)](https://devcompare.dev/compare/tanstack-react-query-vs-xstate)

Data from npm, Bundlephobia and GitHub. Last updated 2026-06-02.