📦
State Management500K+/wkMIT

valtio

Valtio is a proxy-based state management library for React that makes state management as simple as mutating a JavaScript object. Valtio uses JavaScript Proxy t

Installation

npm
npm install valtio
yarn
yarn add valtio
pnpm
pnpm add valtio

Import

ESM
import { proxy, useSnapshot } from 'valtio';

Quick Example

usage
import { proxy, useSnapshot } from 'valtio';

const state = proxy({ count: 0, text: 'hello' });

function Counter() {
  const snap = useSnapshot(state);
  return (
    <button onClick={() => { state.count++; }}>
      {snap.count}
    </button>
  );
}

About valtio

Valtio is a proxy-based state management library for React that makes state management as simple as mutating a JavaScript object. Valtio uses JavaScript Proxy to track which properties are accessed during rendering and automatically re-renders components when those specific properties change. State is created with proxy({ count: 0, text: 'hello' }), and components read state reactively using the useSnapshot() hook: const snap = useSnapshot(state). Mutations are applied directly to the proxy object: state.count++ — no action creators, reducers, or immutable update patterns needed. Valtio detects which properties each component reads and only triggers re-renders when those exact properties change, providing optimal performance without manual memoization. The library supports nested objects and arrays, computed properties through derive(), subscriptions for side effects, and devtools integration for debugging. Valtio works with TypeScript and provides proxyWithComputed for derived state, proxyWithHistory for undo/redo, and proxyMap/proxySet for reactive Map and Set collections. Valtio is created by Daishi Kato (who also created Zustand and Jotai) and is designed for developers who prefer the simplicity of mutable state updates with automatic change detection over explicit immutable update patterns.

Quick Facts

Packagevaltio
CategoryState Management
Weekly Downloads500K+
LicenseMIT
Installnpm install valtio

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.