Skip to main content

React interview mastery — fundamentals to senior

React interviews become easier when answers are built from mental models rather than memorized trivia.

Strong answer shape​

1Definition
2Mental model
3Behavior
4Common mistake
5Trade-off
6Production example

Give the direct answer first, then deepen only as the interviewer asks.

Junior foundations​

React
declarative component-based UI library
JSX
syntax describing React element trees, not DOM itself
Props
inputs received from a parent
State
memory owned by component identity/position
Keys
sibling identity across renders
Forms
controlled or uncontrolled ownership

A junior-quality answer should be accurate and concrete. A stronger answer already distinguishes React elements from DOM nodes and explains that keys participate in identity, not only warning suppression.

Controlled vs uncontrolled inputs​

Who owns the current input value?
React state passes value + onChangeControlled
DOM holds value after defaultValueUncontrolled

Neither model is universally better; choose based on workflow, validation, server/form integration, and ownership needs.

Mid-level mental models​

Rendering is calculation; commit makes accepted work visible
Render
component evaluation · pure · restartable
Commit
DOM/ref/layout consequences become visible

Common render triggers include local state, ancestor evaluation, consumed Context changes, and external-store snapshots. Rendering does not imply a DOM mutation.

State is a snapshot​

setCount(count + 1);
setCount(count + 1);

Both calls can use the same captured snapshot. When updates depend on queued previous state:

setCount(c => c + 1);
setCount(c => c + 1);
Setters request a future snapshot
Current render
count snapshot
Next render
new snapshot

Effects, refs, Context, reducers​

Which React mechanism fits the problem?
External system synchronization after commitEffect
Mutable value/DOM handle that should not drive renderingRef
Tree-scoped value distributionContext
Explicit related state transitionsReducer
Pure value derived from current inputsRender calculation

Context distributes a value; it does not automatically provide persistence, selectors, request caching, normalization, or fine-grained subscriptions.

Senior identity and reconciliation​

State preservation follows React identity
Type
component type
Position
logical tree/sibling position
Key
explicit sibling identity

Reconciliation compares the previous React tree with the next description to determine what can be preserved, updated, mounted, or removed. Avoid claiming React performs a generic optimal tree diff.

Concurrency​

Concurrent rendering means schedulable work, not parallel component execution
Interrupt
urgent work may preempt render work
Restart
React may recalculate with fresher inputs
Abandon
obsolete candidate may never commit
Commit
accepted result becomes visible

Render purity matters because not every evaluation commits.

Transition vs deferred value​

useTransition / startTransition
mark updates as non-urgent
useDeferredValue
let downstream rendering consume a lagging value

Neither replaces request debounce/cancellation, caching, workers, or algorithmic optimization.

Suspense and Error Boundaries​

Readiness and failure are different states
Not ready yet
Suspense fallback/reveal boundary
Rendering failed
Error Boundary containment/recovery

Server Components vs SSR​

Server Components
where component code executes + server/client module/serialization boundary
SSR
how initial HTML is produced and delivered/hydrated

They can be used together, but they solve different problems.

Senior answer pressure test​

Can you make the answer senior-level?
Only definition is correctAdd mechanism and one concrete example
Mechanism is clearAdd failure mode/common misconception
Trade-offs are clearAdd production consequence/testing/observability
You can defend alternatives under different constraintsSenior-level reasoning

A senior interview answer is not longer for its own sake. It reveals a reliable model, scopes the claim, and shows how the choice behaves in production.