Skip to main content

Senior React Architectural Decision-Making

Senior engineering is not memorizing one best practice. It is choosing a trade-off that fits constraints, ownership, failure modes, user impact, reversibility, and operational cost.

Start from constraints, not tools​

Tools come after the problem model
Constraints
users Β· data Β· runtime Β· team Β· reliability Β· security
Architecture options
state Β· rendering Β· boundaries Β· data Β· deployment
Tools
Context Β· store Β· framework Β· library Β· APIs

β€œContext or Zustand?” is weaker than asking who owns the state, who reads/writes it, how frequently it changes, how long it lives, and what persistence/navigation semantics it needs.

Use a repeatable decision frame​

1Problem
2Constraints
3User impact
4Options
5Trade-offs
6Decision
7Validate + rollback

A written decision should make reversal and validation explicit, not merely name the chosen library.

State decision tree​

What kind of state is this?
Fully derived from existing inputsCompute during render
Local interaction stateKeep near the owning component
Small subtree coordinationLift state or focused Context
Workflow with explicit events/transitionsReducer/state-machine model
Remote dataFramework/server-state/cache layer
Navigation/shareable stateURL/search params
External mutable sourceuseSyncExternalStore-compatible subscription

Avoid redundant state when a value can be derived from one existing source of truth.

Rendering is a per-feature decision​

Client rendering
high interactivity Β· browser-only capability Β· client-owned runtime state
SSR/streaming
initial HTML Β· metadata/SEO Β· streamed reveal
Server Components
server-only data/code Β· reduced client graph Β· serializable boundary

Do not choose one rendering mode ideologically for every route.

Keep Client boundaries narrow​

Push interaction to the smallest useful client island
Server page
data + non-interactive structure
Small ClientWidget
state Β· events Β· Effects Β· browser APIs

Every 'use client' boundary expands the client module graph. Check serialization and server-only dependencies at that seam.

Effect decision tree​

Why does this code need to run?
Derived from current props/stateRender
Caused by explicit user interactionEvent handler / Action
Synchronizes committed UI with external systemEffect
Measures/updates layout before paintRare useLayoutEffect case
CSS-in-JS infrastructure style insertionuseInsertionEffect

An Effect is not a generic β€œrun after React” escape hatch.

Context decision frame​

Does Context fit this dependency?
Tree-scoped environment like theme/locale/session facadeOften a good fit
Compound component coordinationOften a good fit internally
High-frequency unrelated global statePrefer more selective ownership/store architecture
Remote cache or URL truthKeep ownership in the correct system instead

Provider breadth and update frequency are architectural concerns, not only performance details.

Reducers are for transition logic​

type Action =
| { type: 'submitted' }
| { type: 'succeeded'; orderId: string }
| { type: 'failed'; message: string };
Reducer value comes from explicit transition ownership
Domain event
submitted / succeeded / failed
Next state
centralized transition rule

Multiple fields alone are not a reason to add a reducer.

Optimistic UI is a risk decision​

Should this mutation be optimistic?
Low-risk reversible interactionOften a good candidate
Failure is common or rollback is confusingPrefer pending/confirmed UI
Money, permissions, destructive irreversible outcomeBe conservative; server confirmation may be safer
Ordering/concurrency is unclearDesign reconciliation before optimistic projection

Optimistic speed is not worth misleading users about irreversible outcomes.

Suspense boundary placement follows reveal units​

Boundary granularity should match meaningful content groups
Too high
one slow widget replaces the whole screen
Balanced
related content reveals together
Too low
many tiny fallbacks flicker independently

Error Boundary placement follows recovery units​

Can this region fail while the rest stays useful?
Yes β€” route/widget/editor/thread can recover independentlyGood Error Boundary candidate
No β€” this leaf has no meaningful fallback/recoveryDo not wrap it only for symmetry

Memoization decisions start with evidence​

Why are you adding manual memoization?
Profiler found repeated expensive workTargeted memo/useMemo may help
Stable function/value identity is part of an API contractuseCallback/useMemo may be justified
Style rule says every handler should be memoizedDo not add it mechanically
React Compiler already optimizes the ordinary caseMeasure before layering manual caches

Correctness and architecture come before memoization complexity.

Scheduling decisions separate urgency from cost​

Scheduling can improve responsiveness without reducing total work
Urgent
typing Β· pressed state Β· direct manipulation
Non-urgent
large result view Β· route/view transition

A Transition can make work interruptible; it does not turn a 200 ms calculation into a 20 ms calculation.

Server Function decisions keep server discipline​

Convenient transport does not remove backend responsibilities
Server Function call
network-accessible mutation boundary
Validation
runtime input
Authorization
resource/action policy
Reliability
idempotency Β· errors Β· observability

Complex business logic may still deserve a service/domain layer behind the Server Function adapter.

Abstraction decisions​

Should repeated code become an abstraction?
Consumers share one stable concept and reason to changeA shared abstraction may be valuable
Markup only looks similar todayWait; duplication can be cheaper than wrong coupling
Abstraction hides ownership or creates many flagsPrefer explicit composition

Migration decisions optimize risk, not novelty​

Incremental migration
smaller blast radius Β· coexistence Β· measurable checkpoints
Rewrite
clean slate but replaces known behavior with unproven behavior

Choose based on unsupported dependencies, security, architecture constraints, testability, team capacity, and reversibilityβ€”not age alone.

Senior decision loop​

1Name owner + constraint
2Model failure/UX
3Compare options
4Choose reversible seam
5Measure/validate
6Document consequences

A strong senior decision is understandable even to someone who would have chosen a different tool, because the constraints and trade-offs are explicit.