Question presented to candidate:
"We could build this UI with plain JavaScript and document.querySelector. Make the case for React — and be honest about what it costs."
What a strong answer should cover:
- The central win: declarative rendering eliminates the class of bugs where the DOM and the data drift out of sync.
- Componentisation — reusable units that own their own state and markup together.
- Reconciliation — React computes the minimal DOM updates so you never hand-write them.
- Ecosystem and hiring — routing, forms, data fetching, testing tools, and a large talent pool.
- Cross-platform — the same component model targets native via React Native.
- Honest costs: a build step, bundle size, a learning curve, and no advantage for genuinely simple pages.
- Maturity signal: React is not automatically faster than hand-written DOM code; it trades a little raw speed for correctness and maintainability.
Clarifying questions expected:
- "How complex is the UI — how much state is there, and how much of it is shared?"
- "Is this a long-lived product with a team, or a one-off page?"
Code / implementation expected: Optional. A side-by-side of the same widget in both styles makes the argument faster than prose.