TanStack Query: Async state management and data fetching
Declarative server-state caching with automatic background synchronization.
Learn more about query
TanStack Query is a JavaScript library for managing asynchronous server state in web applications through automated caching and synchronization mechanisms. It wraps data-fetching logic with intelligent background refetching, automatic cache invalidation, and optimistic updates to keep client-side state synchronized with server data sources. The library implements a query key system that maps data requests to cached entries, enabling automatic deduplication of concurrent requests and efficient cache management across component boundaries. It integrates with popular frontend frameworks like React, Vue, and Solid by providing hooks or primitives that connect component lifecycles to query states. The architecture prioritizes developer experience by handling loading states, error handling, and cache staleness policies declaratively without requiring manual coordination of network requests.

Protocol-agnostic fetching
Works with REST, GraphQL, or any promise-based data source without requiring framework-specific adapters. The same query logic can be reused across different API patterns.
Multi-framework support
Provides framework-specific implementations for React, Vue, Svelte, and Solid through separate packages that share a common query-core engine, allowing consistent patterns across different frontend stacks.
Built-in cache strategies
Implements automatic cache management with configurable stale-while-revalidate behavior, request deduplication, and background refetching without requiring manual cache invalidation logic in most cases.
import { useQuery } from '@tanstack/react-query';
function UserProfile({ userId }) {
const { data, isLoading, error } = useQuery({
queryKey: ['user', userId],
queryFn: () => fetch(`/api/users/${userId}`).then(res => res.json())
});
if (isLoading) return <div>Loading...</div>;
if (error) return <div>Error: {error.message}</div>;
return <div>{data.name}</div>;
}Adds support for passing a getter function to useQuery options, enabling reactive option composition in Vue.
- –Pass a getter function to useQuery options for dynamic, reactive query configuration in Vue components.
- –Release notes do not specify breaking changes, migration steps, or minimum version requirements.
Major version bump with no documented changes beyond a dependency update to @tanstack/vue-query@5.91.0.
- –Release notes do not specify breaking changes, migration steps, or new requirements for the v6 upgrade.
- –Review your dependency tree to ensure compatibility with the updated @tanstack/vue-query peer dependency.
Patch release updating internal query-core dependency; no breaking changes or new requirements specified.
- –Update @tanstack/query-core to 5.90.8 for internal fixes or improvements.
- –Release notes do not specify breaking changes, migrations, or security fixes.
See how people are using query
Related Repositories
Discover similar tools and frameworks used by developers
chenyuluoyan_thin
A refined thin-weight Chinese font family designed for modern digital interfaces, offering graceful readability and aesthetic appeal for web and application typography.
next.js
File-based React framework with hybrid rendering strategies.
yup
JavaScript schema validation with chainable API and type inference.
fonts
TrueType font binaries and metadata organized by license.
AdminLTE
Production-ready Bootstrap 5 template with SCSS build tooling.