Valtio

Valtio

github.com

1

About this website

Valtio is a proxy-based state management library for React that makes immutable state feel mutable through JavaScript Proxy objects. Created by Daishi Kato and maintained under the pmndrs collective, the library turns any JavaScript object into a self-tracking proxy where mutations are automatically captured and translated into immutable snapshots for React consumption. Developers write state updates as direct property assignments rather than calling setter functions or dispatching actions, resulting in code that reads like plain JavaScript while maintaining the predictability of immutable state under the hood. The useSnapshot hook subscribes a component to the proxy state, re-rendering only when accessed properties change. Because tracking happens at the property level through proxy traps, components can destructure and access nested state without triggering re-renders for unrelated changes elsewhere in the state tree. Derived state is computed lazily and cached automatically. The subscribe API enables side effects outside React, and subscribeKey targets specific property changes. Middleware includes devtools for Redux DevTools time-travel debugging, persist for localStorage synchronization, and immerValtio for combining immer patches. The library handles async state naturally without wrapper functions, and supports non-React environments through the vanilla API. Snapshot interpolation is available for smooth animations between state transitions. Weighs approximately 3 kilobytes minified and gzipped. Over 9,300 GitHub stars. Open source under the MIT license.

Tags & Categories

Statistics

1
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!