What problem does it solve?
This skill standardizes how the frontend fetches, caches, and manages server state so teams stop scattering fetch logic across components and relying on fragile useState/useEffect patterns.
Core Features & Use Cases
- TanStack Query integration: centralized QueryClient defaults for stale time, cache retention, retries, and refetch behavior.
- API layer abstraction & TypeScript: single apiRequest entrypoint for consistent headers, error handling, and typed endpoints for listings, bookings, and auth.
- Mutation & UX rules: mutation patterns with invalidateQueries, optimistic update guidance, and three-state page handling (loading skeleton, retryable error, empty state).
- Use Case: implement a BrowsePage that uses a typed useListings hook with filter-aware queryKeys, shows skeletons while loading, handles errors with retry, and invalidates bookings after mutations.
Quick Start
Configure a QueryClient, implement src/lib/api.ts as the sole request layer with token injection and error parsing, then create a typed useListings hook that queries /api/listings with filter-aware queryKeys.