Skip to main content

Architecture and patterns visual mental model

Good React architecture makes ownership obvious and change predictable. It is not the architecture with the most folders, abstractions, or global providers.

Architecture starts with ownership
Who owns it?
Component · feature · URL · server · external store
Who reads it?
One component · subtree · distant features · non-React code
Who writes it?
User intent · server mutation · reducer/action · navigation
How long does it live?
Render · component · route · feature · app · persisted lifetime
Where can it fail?
Network · validation · render · external system · permission boundary
What should depend on what?
Domain contracts should not be hidden behind accidental UI coupling.

Keep state close to its real owner​

Local first, lift only for coordination
One component owns the interaction
Keep state local.
Closest shared owner
Lift state only to the boundary that coordinates both consumers.
Choose a wider state mechanism deliberately
Context, external store, URL, or server state based on the actual category.

Feature boundaries align concerns​

Healthy feature boundary
Public feature API
Components · hooks · selectors · commands · domain types
Private implementation
Internal state · helpers · adapters · rendering details
External dependencies
Router · server APIs · storage · shared design system
Tests
Verify behavior and boundary contracts, not private wiring.

Prefer composition over configuration explosion​

Component API design
SmellMega component
Dozens of unrelated booleans and props create impossible combinations.
ComposableFocused primitives
Small contracts compose into richer behavior while ownership stays clear.

Architecture minimizes synchronization edges​

One source of truth reduces coupling
One authoritative owner
Consumers derive or subscribe
Fewer synchronization bridges
Fewer race conditions and easier debugging
Where should this concern live?
Only one visual region needs itKeep it local
Sibling regions must coordinateLift to their closest shared owner
Navigation/bookmarking defines itURL/router state
Server owns the authoritative dataServer data/cache layer
Many client features need structured shared ownershipEvaluate Context or an external store

Keep this mental model​

React architecture in one picture
Ownership
One clear source.
Boundaries
Feature contracts.
Dependencies
Intentional direction.
Change
Predictable impact.

Continue with Component and State Architecture for detailed feature structure, composition patterns, design systems, and senior trade-offs.