How TanStack Query caches, deduplicates, prefetches, and rolls back
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
- Not answered. What separates server state from client state?
- Not answered. Which of these are client state?
- Not answered. Why does the roster still show the old name?
- Not answered. How many network requests go out?
- Not answered. Why cancel queries before an optimistic write?
- Not answered. Which statements about optimistic updates in
useMutationare true? - Not answered. What makes this loader slow, and how do you fix it?
- Not answered. Which techniques help remove request waterfalls?
- Not answered. What does
prefetchQueryon hover do? - Not answered. How do you stop refetching data that never changes?
- Not answered. How does
useSuspenseQuerychange your component? - Not answered. Which
useMutationcallback runs before the mutation function?