Top 30 State Management Interview Questions and Answers
30 multiple-choice questions on State Management, drawn from 30 bites out of the 79 tagged State Management on Tezvyn. Answer them here or read straight down. Every question carries the correct option, why it is correct, and a link to the bite it came from.
30 questions. Pick an answer, or open “Show the answer” to read it.
Answers are graded in your browser. Nothing is saved, and no XP or streak is earned here. The app keeps score.
Question 1 of 30
Why is storing user uploads on an auto-scaled instance's local disk a poor design choice?
Show the answer
Answer: d · The data is lost when the instance is terminated or replaced during scaling
Auto-scaled instances are ephemeral, so any durable data on local disk vanishes on replacement. Local disks can store binaries and are often fast; the fatal issue is impermanence, not speed or file type.
Read the full bite: Managing state across ephemeral instances
Question 2 of 30
For which situation should you reach for useReducer instead of multiple useState hooks?
Show the answer
Answer: d · Coordinating several related fields that must update atomically from one action
useReducer excels when one action must update multiple interdependent fields atomically, centralizing transition logic outside the component. Option A is a common misconception because the hook itself does not memoize child renders or improve performance without additional optimizations like React.memo.
Read the full bite: Explain useReducer and when to prefer it over useState
Question 3 of 30
You need to build a Flutter button that increments a local counter and updates its label each time it is pressed. Which design choice follows Flutter's widget model correctly?
Show the answer
Answer: c · Use a StatefulWidget because the mutable counter belongs in the State object, which persists across rebuilds while the widget stays immutable.
The correct answer reflects the two-class architecture: the immutable widget is recreated, but the State object persists and owns mutable data like a counter. Distractor B is tempting because beginners often believe the StatefulWidget class itself stores mutable fields, yet the card clarifies that mutability lives only in the separate State object.
Read the full bite: Explain StatelessWidget vs StatefulWidget and when to choose each
Question 4 of 30
A ThemeContext.Provider wraps the entire app and passes an unmemoized object containing theme and toggleTheme. What is the main performance risk?
Show the answer
Answer: d · Every consumer re-renders whenever the Provider re-renders because the object reference changes each time
React compares context values by reference, so a new object literal on every render triggers re-renders in all consumers even if the theme data is unchanged. Option A is tempting because developers often assume context supports selective subscriptions by property, but React does not optimize that way.
Read the full bite: Use useContext to provide theme state without prop drilling
Question 5 of 30
What is the primary consequence if you forget to update your app's state within the onValueChange callback for a React Native Switch?
Show the answer
Answer: b · The Switch will visually revert to its previous state after the user interaction.
The card explicitly states that if the state isn't updated, "the switch will appear to snap back to its original position." This is because the Switch's visual state is controlled by the 'value' prop, which won't change if the underlying state isn't updated. Option D is incorrect because the visual state does not persist; it reverts.
Read the full bite: React Native's Controlled Switch Component
Question 6 of 30
In a context-reducer feature, a component only dispatches actions but never reads state. How do you prevent it from re-rendering when state changes?
Show the answer
Answer: c · Provide state and dispatch through two separate contexts and consume only the dispatch context
Splitting state and dispatch into two contexts lets components subscribe only to the stable dispatch function, isolating them from state reference changes. React.memo cannot prevent re-renders caused by a changing context value, and useReducer already returns a stable dispatch, so memoizing it with useCallback does not solve the subscription problem.
Read the full bite: Describe combining useContext and useReducer for scalable feature state
Question 7 of 30
A child view receives an ObservableObject from its parent, must update when it publishes changes, and must not manage its lifecycle. Which wrapper fits?
Show the answer
Answer: d · @ObservedObject, because the child receives a reference-type object it does not own
@ObservedObject is correct because the child gets an externally created ObservableObject and must react to its updates without taking ownership. @Binding is tempting because the data comes from the parent, but it is meant for value types, not reference-type ObservableObjects.
Read the full bite: Differences between @State, @Binding, @ObservedObject, and @EnvironmentObject
Question 8 of 30
In Flutter, a parent widget rebuilds frequently due to state changes, but its child displays static data. Which approach correctly prevents the child's build method from running unnecessarily?
Show the answer
Answer: c · Extract the child into its own StatelessWidget and invoke it with a const constructor.
Extracting the child into its own StatelessWidget and invoking it with const creates a build boundary, allowing Flutter to reuse the existing element and skip calling build on that subtree. Wrapping it in a RepaintBoundary is a common misconception because that only reduces paint cost during rasterization, not build-phase work.
Read the full bite: How can you prevent unnecessary child rebuilds in Flutter?
Question 9 of 30
How does a self-registering Field pattern keep the Form decoupled from the specific fields used inside it?
Show the answer
Answer: b · Fields register themselves by name into shared context, so the Form never enumerates them
Self-registration lets the Form coordinate validation and submission over whatever fields registered, with no hardcoded list. Enumerating fields or centralizing all rules in the Form recreates the coupling you want to avoid.
Read the full bite: Decoupling Form state from its Field components
Question 10 of 30
In Flutter, two sibling widgets need to read and modify the same piece of data. Where should that state live?
Show the answer
Answer: b · In the closest common ancestor widget, passed down via constructors and callbacks
Placing the state in the closest common ancestor ensures both siblings receive the value and can send events back up via callbacks. Keeping the state inside one child is incorrect because the sibling cannot access it declaratively, violating Flutter's unidirectional data flow.
Read the full bite: Explain lifting state up with a concrete scenario and benefits
Question 11 of 30
To ensure injected data updates reactively in descendant components, what must be true about the provided value?
Show the answer
Answer: a · It must be a reactive object, such as one created with ref() or reactive().
The card states that for data to be reactive, you must provide a reactive object like one created with ref() or reactive(). Providing a static or primitive value will not trigger updates in child components if it changes in the parent.
Question 12 of 30
When a ReorderableListView child is dragged to a new index without a Key, what happens to its underlying Element during reconciliation?
Show the answer
Answer: d · It remains at the original index and receives whatever widget now occupies that slot.
Without a Key, Flutter matches by runtime type and tree position, so the Element stays at its original slot and is updated with the new widget reference there, leaving its State behind. Option A describes what happens only when a stable Key provides explicit identity, allowing Flutter to reparent the Element to its new position.
Read the full bite: What are Keys in Flutter and why are they critical?
Question 13 of 30
In a wizard form, why should step values be merged into a shared accumulated store rather than kept only in each step's local state?
Show the answer
Answer: a · So navigating back and forth preserves previously entered data across steps
Centralizing accumulated values lets data persist when a step unmounts on navigation, so going back shows prior input. Steps still own their own validation, and the store is about persistence, not rendering all steps at once.
Read the full bite: Designing a multi-step wizard form pattern
Question 14 of 30
Which data is the best fit for the Context API rather than local props?
Show the answer
Answer: c · App-wide, infrequently changing data like the current theme or authenticated user
Context shines for stable, broadly needed data like theme or auth, avoiding prop drilling. High-frequency state in Context triggers wide re-renders, and one-level passing is simpler with plain props.
Question 15 of 30
Which situation most clearly justifies a global store like Redux or Zustand over local state?
Show the answer
Answer: d · The authenticated user and cart needed by many distant components across the app
Global stores fit data shared and mutated by many distant components, like auth and cart. The other cases are owned by one component or subtree and are best kept local or lifted slightly.
Read the full bite: Local state versus global state management
Question 16 of 30
Which action inside a Redux reducer violates its core principles?
Show the answer
Answer: a · Calling an API and dispatching based on the response from within the reducer
Reducers must be pure: no side effects and no mutation. Performing an API call inside one breaks purity; async work belongs in middleware like thunks. The other options are correct reducer behavior.
Read the full bite: Redux principles: store, actions, reducers
Question 17 of 30
What architectural difference lets Zustand expose store state without wrapping the component tree in a Provider?
Show the answer
Answer: c · It stores state in a module-level closure that the generated hook reads from directly
Zustand keeps state in a closure outside React and returns a hook that subscribes to it, so no Provider is required. It does not wrap Context or sit on top of Redux, making those options incorrect.
Question 18 of 30
Which of the following must be true for a plain JavaScript object to act as a valid Svelte store?
Show the answer
Answer: a · It must implement a subscribe method that accepts a callback and returns an unsubscribe function.
Svelte recognizes any object as a store as long as it provides a subscribe method that takes a callback and returns an unsubscribe function. Option D is tempting but wrong because the $ prefix is consumer-side auto-subscription syntax in .svelte files, not part of the store's definition contract.
Read the full bite: How do Svelte Stores work and how do you create custom ones?
Question 19 of 30
Which statement correctly describes a trade-off of uncontrolled React inputs?
Show the answer
Answer: b · They avoid re-renders but hide the value from React until explicitly read
Uncontrolled inputs store value in the DOM, so React cannot react to changes until the value is explicitly read from a ref, which sacrifices live validation for less boilerplate. Distractor B is tempting because refs are indeed used with uncontrolled inputs, but live validation is impossible because React has no visibility into the keystrokes.
Read the full bite: Explain controlled vs uncontrolled React form inputs and trade-offs
Question 20 of 30
To programmatically return to the root of a SwiftUI NavigationStack, what should you modify?
Show the answer
Answer: c · The NavigationPath binding owned at or above the root view
SwiftUI navigation is data-driven, so you clear the bound NavigationPath that serves as the source of truth for the stack depth. Reaching for the underlying UINavigationController breaks the declarative model and reflects a UIKit mindset.
Read the full bite: How do you pop to root in SwiftUI NavigationStack?
Question 21 of 30
Why is remember typically paired with mutableStateOf for local composable state?
Show the answer
Answer: c · remember persists the state across recompositions, while mutableStateOf makes it observable and triggers recomposition when changed
remember caches the state object across recompositions, and mutableStateOf wraps that value so Compose can observe changes and recompose. Option D is tempting but wrong because remember does not survive configuration changes; rememberSaveable does.
Read the full bite: What is remember in Compose and how do you use mutableStateOf?
Question 22 of 30
Which scenario most clearly justifies using useReducer instead of useState for React form state?
Show the answer
Answer: c · A multi-step wizard where country selection changes provinces, enables VAT, and triggers async tax lookups
The wizard's cascading interdependencies and async transitions are best centralized in a pure reducer; option D describes coupled fields appropriately managed by a single object with useState, not useReducer.
Read the full bite: Prefer multiple useState or useReducer for multi-field forms?
Question 23 of 30
Which architectural change in NavigationStack fundamentally fixes the fragility of deep linking and multi-layer pushes that plagued NavigationView?
Show the answer
Answer: b · Replacing per-link isActive boolean bindings with a single explicit array representing the entire route stack.
NavigationStack replaces scattered isActive bindings with a centralized path array, enabling reliable deep linking by mutating a single data structure. Option A reflects the common misconception that NavigationStack is merely a visual or naming update, when in fact it fundamentally changes how navigation state is modeled.
Question 24 of 30
When building real-time email validation in React, which state strategy best follows declarative, state-driven patterns?
Show the answer
Answer: d · Store the raw input in useState, use a single status enum such as typing or error, and derive validation during render.
The correct approach uses a single status enum and derives validation during render, avoiding redundant state. Option A is wrong because multiple boolean flags require manual synchronization and invite stale state bugs.
Read the full bite: How would you implement real-time client-side validation in React?
Question 25 of 30
In a Flutter form using reactive_forms, which pattern correctly implements async username validation while preserving UX and stream hygiene?
Show the answer
Answer: b · Set debounceTime on the async validator, cancel obsolete requests, and bind a loading indicator to the pending status
Option B correctly combines debouncing to reduce API load, canceling obsolete requests to prevent stale results from overwriting newer input, and keeping loading state separate from validation errors. Option C is tempting because it mentions debounceTime, but queuing requests instead of canceling them causes race conditions, and emitting a validation error during checking conflates loading with errors.
Read the full bite: Implement efficient async username validation in Flutter
Question 26 of 30
Which approach correctly separates navigation from presentation in a unit-testable conditional wizard for both UIKit and SwiftUI?
Show the answer
Answer: c · Model the flow as a state machine enum with plain Swift transition logic and derive the UIKit and SwiftUI stacks from that state.
Modeling the wizard as a state machine enum with plain Swift transition logic lets you derive the stack for both UIKit and SwiftUI and unit test transitions without launching a UI. Option B is tempting because coordinators correctly separate UIKit concerns, but relying on local @State inside onAppear handlers still buries imperative navigation inside the view rather than driving it declaratively from the model.
Read the full bite: Design state-driven navigation for a conditional wizard in UIKit and SwiftUI
Question 27 of 30
How does React Hook Form primarily avoid re-rendering an entire form on every keystroke, compared to manual useState management?
Show the answer
Answer: d · It registers inputs via refs and treats them as uncontrolled, reading values only when needed.
React Hook Form attaches refs to inputs and keeps them uncontrolled so React does not render on every keystroke; values are read at validation or submission. The first option describes Formik's context-and-subscription strategy, which is a common point of confusion between the two libraries.
Read the full bite: Advantages of dedicated React form libraries over manual state
Question 28 of 30
Which approach is most robust for deciding whether to display a setup guide to a returning user?
Show the answer
Answer: a · Storing a dedicated has_seen_setup_guide flag in the user's server-side record
A server-side flag records the actual interaction and remains accurate across data migrations, device changes, and guide redesigns. Relying on created_at is brittle because that fixed timestamp cannot be reset when you need to rerun onboarding or backfill users.
Read the full bite: How do you determine if a user is 'new' for a setup guide?
Question 29 of 30
Which pattern best prevents data loss and supports accurate per-step validation when users move non-linearly through a React wizard?
Show the answer
Answer: c · Maintain a single root form instance, validate only the current step's Zod slice before advancing, and hydrate defaultValues from localStorage on mount.
A single root form with per-step Zod slices ensures only touched fields are validated before navigation, while localStorage hydration prevents data loss on refresh. Option A is tempting because it correctly centralizes the form, but validating the entire schema prematurely surfaces errors for untouched future fields and skipping persistence leaves users vulnerable to data loss.
Read the full bite: Design a multi-step wizard form pattern in React
Question 30 of 30
When migrating a team from local to remote state, which requirement is most important to prevent corrupted infrastructure mappings?
Show the answer
Answer: d · Configuring a remote backend with state locking to serialize concurrent plan and apply operations.
State locking is the only mechanism that prevents race conditions when multiple engineers run apply simultaneously, which would otherwise overwrite resource mappings and corrupt state. Encryption, versioning, and IAM restrictions are important security and recovery measures, but none of them block concurrent modifications.
Read the full bite: Explain Terraform state, why managing it is critical, and team best practices
Could you explain these out loud?
That is what an interview actually tests. Tezvyn gives you questions like these with what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.