Loading…
Loading…
The developer library
Senior full stack interview questions and answers built around real engineering choices. Explore by stack, compare tradeoffs, and practise explaining the why.
Frontend state to backend concurrency.
Choose state boundaries, design cart flows, and explain predictable shared updates.
02 / FrontendUnderstand providers, state ownership, and the tradeoffs of sharing data through context.
03 / BackendReason about the event loop, asynchronous work, parallelism, and worker threads.
Choose a topic, read the answer, and work through the example. Explain state ownership, failure handling, and the tradeoffs behind your approach.
Use the answers as discussion starters. State your assumptions, explain the tradeoff, and describe how you would handle failure.
Filter by topic or search the full answers.
28 of 28 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 16Context makes a provider value available to descendants without passing it through each intermediate component. Consumers read the nearest matching provider.
Link to question 17It distributes a value through a subtree. That value can include data and update functions, but context itself is not a persistence mechanism.
Link to question 18Decide from update frequency, consumer count, debugging requirements, and transition complexity. Context can suit scoped configuration; Redux can suit coordinated feature state. Neither choice is universally better.
Link to question 19Consider render behavior and maintenance. Context consumers update when their provider value changes. Split unrelated contexts and stabilize values when useful; store selectors can narrow subscriptions for frequently changing data.
Link to question 20The provider component or an external store owns changing state. Context exposes its current value. Pair it with useState or useReducer when consumers need updates.
Link to question 21React data flow remains one-way. A provider passes values down; a consumer can invoke a supplied callback to request an update at the owner. The changed value then flows down on the next render.
Link to question 22Node.js is a JavaScript runtime, not a language. JavaScript normally executes on one main event-loop thread per isolate, while runtime facilities and explicit workers can use other threads.
Link to question 23It coordinates non-blocking I/O through the event loop, operating-system facilities, and a runtime thread pool for selected APIs. Awaiting independent I/O allows other work to progress; synchronous computation still blocks its thread.
Link to question 24Use node:worker_threads for CPU-heavy JavaScript. Prefer a bounded pool for recurring jobs and define task messages, timeouts, cancellation, and error handling.
Link to question 25A worker executes JavaScript in its own isolate and event loop. The parent sends inputs and receives outputs through messages. Workers help with CPU work and usually add unnecessary overhead for ordinary asynchronous I/O.
Link to question 26Single-threaded execution describes one isolate. Creating a worker creates another execution environment with its own JavaScript thread within the process.
Link to question 27Use explicit message protocols and task identifiers. Data is generally cloned or transferred; SharedArrayBuffer enables deliberate shared memory with synchronization such as Atomics. Handle worker errors and exits.
Link to question 28Technical references for the concepts in this collection.
Redux Essentials ↗React: passing data with context ↗Node.js: worker threads ↗