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 .
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β
1 Problem
β 2 Constraints
β 3 User impact
β 4 Options
β 5 Trade-offs
β 6 Decision
β 7 Validate + 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 inputs β Compute during render
Local interaction state β Keep near the owning component
Small subtree coordination β Lift state or focused Context
Workflow with explicit events/transitions β Reducer/state-machine model
Remote data β Framework/server-state/cache layer
Navigation/shareable state β URL/search params
External mutable source β useSyncExternalStore-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β
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/state β Render
Caused by explicit user interaction β Event handler / Action
Synchronizes committed UI with external system β Effect
Measures/updates layout before paint β Rare useLayoutEffect case
CSS-in-JS infrastructure style insertion β useInsertionEffect
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 facade β Often a good fit
Compound component coordination β Often a good fit internally
High-frequency unrelated global state β Prefer more selective ownership/store architecture
Remote cache or URL truth β Keep 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 } ;
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 interaction β Often a good candidate
Failure is common or rollback is confusing β Prefer pending/confirmed UI
Money, permissions, destructive irreversible outcome β Be conservative; server confirmation may be safer
Ordering/concurrency is unclear β Design reconciliation before optimistic projection
Optimistic speed is not worth misleading users about irreversible outcomes.
Suspense boundary placement follows reveal unitsβ
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 independently β Good Error Boundary candidate
No β this leaf has no meaningful fallback/recovery β Do not wrap it only for symmetry
Memoization decisions start with evidenceβ
Why are you adding manual memoization?
Profiler found repeated expensive work β Targeted memo/useMemo may help
Stable function/value identity is part of an API contract β useCallback/useMemo may be justified
Style rule says every handler should be memoized β Do not add it mechanically
React Compiler already optimizes the ordinary case β Measure before layering manual caches
Correctness and architecture come before memoization complexity.
Scheduling decisions separate urgency from costβ
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β
Server Function call network-accessible mutation boundary
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 change β A shared abstraction may be valuable
Markup only looks similar today β Wait; duplication can be cheaper than wrong coupling
Abstraction hides ownership or creates many flags β Prefer 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β
1 Name owner + constraint
β 2 Model failure/UX
β 3 Compare options
β 4 Choose reversible seam
β 5 Measure/validate
β 6 Document 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.