Skip to content

Quiz: Predict the State

advanced12 min read

Module Quiz: State Management Architecture

You've covered the five categories of state, specialized tools for each, and advanced patterns like optimistic updates and real-time synchronization. Time to test whether the mental models stuck.

These questions are designed to test decision-making, not memorization. Each one presents a scenario where the "right" answer depends on understanding the trade-offs — not just knowing the API.

Quiz
Your app fetches a user profile on mount. You store it in Zustand. A colleague edits the user's role on the admin panel. Your app still shows the old role until the user refreshes. What's the root cause?
Quiz
Two components use useQuery({ queryKey: ['products', { category: 'shoes' }] }). Component A is on the left sidebar, Component B is in the main content area. What network request behavior occurs?
Quiz
You have a Zustand store with 10 properties. A component reads only 'theme' via useStore(s => s.theme). You update 'notificationCount' in the store. Does this component re-render?
Quiz
Your product listing page has filters in the URL (?category=shoes&sort=price). The user changes the category. What should happen to the page parameter?
Quiz
A user clicks 'Delete Comment' in your app. You use an optimistic update to immediately remove the comment from the UI. The server returns a 403 Forbidden. What should happen?
Quiz
You're using XState for a multi-step checkout flow. The machine is in the 'payment' state. The user's session expires, and a SESSION_EXPIRED event is received. But 'payment' doesn't have a SESSION_EXPIRED transition. How should you handle this?
Quiz
You're building a collaborative document editor with 200 concurrent users. Each user's cursor position updates at 30fps. Which data flows over WebSocket?
Quiz
Your Jotai store has: itemsAtom, filterAtom, and a derived filteredItemsAtom that depends on both. A component only reads filteredItemsAtom. You update filterAtom but the filter produces the exact same result (same items pass). Does the component re-render?
Quiz
You set staleTime: 5 * 60_000 and gcTime: 30 * 60_000 on a TanStack Query. The user views the data, navigates away for 10 minutes, then returns. What happens?
Quiz
You need state for: (1) user session from API, (2) search query in a text input, (3) 'dark mode' preference that persists across sessions, (4) items in a collaborative shared list updated via WebSocket. Match each to the right tool.