What problem does it solve? Managing server state in frontend applications requires handling caching, background refetching, pagination, and optimistic updates manually, which leads to duplicated boilerplate and stale data bugs. ## Core Features & Use Cases - Declarative Data Fetching: Use useQuery with hierarchical query keys for automatic caching, deduplication, and background refetching. - Mutations & Optimistic Updates: Apply useMutation with onMutate snapshots and rollback logic to update the UI before server confirmation. - Pagination, Infinite Scroll & SSR: Implement useInfiniteQuery, placeholderData pagination, prefetching in route loaders, and hydration for server-rendered apps. - Use Case: Build a dashboard that fetches users and projects in parallel, prefetches detail pages on hover, and optimistically adds new todos with automatic rollback on failure. ## Quick Start Set up TanStack Query in my React app with a QueryClientProvider and write a useQuery hook that fetches and caches a list of todos.