Loading…
Loading…
Frontend · Senior full stack preparation
Choose state boundaries, design cart flows, and explain predictable shared updates. Read practical answers and use the examples to explain your reasoning.
16 of 16 questions
Redux is itself state management. Choose it for coordinated shared client state with complex transitions, debugging needs, and many consumers. Keep isolated interactions in useState or useReducer.
Link to question 1Classify data by ownership and lifetime before choosing a tool. Keep transient UI near its owner, use shared state for cross-feature workflows, and give fetched server data an explicit cache strategy. Application size alone does not decide.
Link to question 2It means changing a shared source of client state. Consumers observe the new value through their subscriptions; it does not mean every component must render or every browser receives the update.
Link to question 3No. Choose based on the number of consumers, transition complexity, and persistence requirements. Lifted state or reducer plus context can suit a small cart; Redux Toolkit can suit a larger coordinated flow.
Link to question 4Send a removal intent with a stable item or variant identifier. Update shared cart state through its reducer and synchronize a persisted cart with the API. Handle pending requests and restore or refetch on failure.
Link to question 5The cart view, header count, and checkout must agree. A single transition makes the rule explicit and testable; each consumer derives its own display from the same state.
Link to question 6Only if the backend had reserved stock. Cart membership alone need not reserve inventory. The server owns stock and must release reservations atomically according to expiry and cancellation rules.
Link to question 7Props are inputs passed from parent to child. Redux is an external store with explicit update logic. They work together: a connected container can read the store and pass props to presentation components.
Link to question 8Props are read-only component inputs, including values, children, and callbacks. A child requests changes by invoking a callback rather than mutating its inputs.
Link to question 9It provides a store and a predictable model for state transitions through dispatched actions and reducers. Redux Toolkit is the standard starting point for new Redux code.
Link to question 10State is component memory across renders. A setter schedules a render with a new state snapshot; event handlers see the snapshot from their render. Avoid mutating objects held in state.
Link to question 11Separate cart lines, temporary offer selection, server pricing, and UI status. Validate eligibility and totals on the server. Removal must invalidate or recalculate dependent discounts and clear an ineligible offer.
Link to question 12Use the owner already chosen for the cart. If the cart is in Redux, dispatch an add intent; otherwise use the cart reducer or server mutation. A click alone does not justify a new global store.
Link to question 13Send the selected offer and relevant checkout information to the pricing API. Show loading and eligibility feedback, then render the validated discount. Do not trust a client-calculated payable total.
Link to question 14Share it only across components that need it, for as long as needed. A checkout-scoped provider may be enough. Invalidate it when its eligibility inputs change.
Link to question 15For limited sharing, lift state to a common parent and pass values and callbacks. Wider trees may benefit from context or an external store. Props transport data; some owner must still hold and update it.
Link to question 16