Back to the catalog

How TanStack Query caches, deduplicates, prefetches, and rolls back

12 questions

Many of the big decisions in a React frontend come down to where data lives and when you fetch it. This quiz starts with the split between server state (a cached copy of data you don't own) and client state. Then it covers document vs. normalized caches, request deduplication, optimistic updates and rollback, request waterfalls, prefetching, staleTime, and how Suspense changes component design. The examples use React and TanStack Query.

Questions

  1. Not answered. What separates server state from client state?
  2. Not answered. Which of these are client state?
  3. Not answered. Why does the roster still show the old name?
  4. Not answered. How many network requests go out?
  5. Not answered. Why cancel queries before an optimistic write?
  6. Not answered. Which statements about optimistic updates in useMutation are true?
  7. Not answered. What makes this loader slow, and how do you fix it?
  8. Not answered. Which techniques help remove request waterfalls?
  9. Not answered. What does prefetchQuery on hover do?
  10. Not answered. How do you stop refetching data that never changes?
  11. Not answered. How does useSuspenseQuery change your component?
  12. Not answered. Which useMutation callback runs before the mutation function?