// the find
TanStack/query
🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query.
TanStack Query is the de facto standard for server-state management in React (and increasingly Solid, Vue, Svelte, Angular). It handles fetching, caching, background revalidation, pagination, and mutations with a consistent API across frameworks. Targeted at any frontend developer who needs to sync UI state with a server without rolling their own cache logic.
- The framework-agnostic core (`@tanstack/query-core`) is genuinely well-architected — the React, Solid, Vue, and Svelte adapters all sit on top of the same observer/cache machinery, so bug fixes and features propagate everywhere.
- TypeScript support is first-class: `queryOptions()` and `infiniteQueryOptions()` helpers let you define typed query factories once and get inference all the way through `useQuery`, `prefetchQuery`, and `getQueryData` without casting.
- The ESLint plugin ships rules like `exhaustive-deps` and `no-unstable-deps` that catch the most common footguns (dynamic query keys that change every render, missing deps in query functions) at lint time rather than at 3am.
- The stale-while-revalidate cache model with configurable `staleTime`/`gcTime`, structural sharing on returned data, and automatic deduplication of in-flight requests means you get sane defaults that actually work in production without much tuning.
- Optimistic updates remain genuinely awkward: you have to manually snapshot, mutate the cache, and roll back in `onError`, with no built-in compensation transaction model. Every non-trivial mutation requires boilerplate that's easy to get subtly wrong.
- The Angular adapter (`injectQuery`) is significantly less mature than the React one — docs are thinner, SSR story is incomplete compared to React, and it lags behind on new features like `skipToken` support.
- Infinite query pagination is powerful but the API surface is showing its age: `getNextPageParam`, `getPreviousPageParam`, `pageParams` array, and `maxPages` are all separate knobs that interact in non-obvious ways, especially when combined with cache invalidation.
- There's no built-in request middleware or interceptor layer — if you need to inject auth headers, retry on 401, or transform errors globally, you're expected to wrap your fetch function yourself in every `queryFn`, or bolt on something like `axios` interceptors outside the library's awareness.