What is the proxy state pattern (Valtio / Immer) versus immutable state?

Answer

The proxy state pattern and immutable state pattern represent fundamentally different approaches. Immutable state (Redux, Zustand): state never changes — updates create new objects. Enables reference equality checks (prev === next means no change), time-travel debugging (save old state references), and structural sharing. All React state management best practices are built around immutability. Debugging: see exactly what changed between two snapshots. Proxy state (Valtio, MobX, Vue): Proxy intercepts property access and mutation. State appears mutable but reactivity is tracked automatically. Less boilerplate for updates. Familiar for developers from Vue/MobX. Immer's hybrid: writes look mutable, produces immutable results. Best of both worlds — mutating syntax, immutable semantics. Trade-offs: Proxy state is more ergonomic for deeply nested updates. Immutable state is more predictable and debuggable. Proxy-based libraries can have surprising behavior when state is shared across module boundaries (Proxy objects vs plain objects). For large teams, immutable state (enforced by TypeScript readonly types) reduces a class of mutation bugs. For smaller projects, proxy-based Valtio offers excellent DX with minimal ceremony.