What problem does it solve?
This Skill simplifies the management of asynchronous server state in applications, handling complex tasks like data fetching, caching, background synchronization, and optimistic updates, thereby reducing boilerplate code and improving application performance.
Core Features & Use Cases
- Declarative Fetching: Define data fetching logic using query keys and functions.
- Automatic Caching: Caches query data to avoid redundant network requests.
- Background Refetching: Refreshes data automatically in the background on window focus, reconnect, or at defined intervals.
- Mutations: Manages server state updates (POST, PUT, DELETE) with built-in support for optimistic updates and invalidation.
- Use Case: When building a dashboard that displays real-time user data, use TanStack Query to efficiently fetch, cache, and update this data as users interact with the application or as new information becomes available.
Quick Start
Use the tanstack-query skill to explain how to invalidate queries after a mutation.