VA

Valtio

valtio

🧙 Valtio makes proxy-state simple for React and Vanilla

State Management
react
state
manager
management
mobx
proxy
store
valtio
State Management
javascript
Stars
10k
Weekly
1.3M
Open issues
6
Bundle
~25 kB

Installation

npm install valtio

Code example

import { proxy, useSnapshot } from "valtio";

const state = proxy({ count: 0 });

export function Example() {
  const snap = useSnapshot(state);
  return (
    <button type="button" onClick={() => { state.count += 1; }}>
      Count: {snap.count}
    </button>
  );
}

Pros & cons

Pros

  • Actively maintained by Daishi Kato
  • 1.3M weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~25 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 6 open issues on GitHub

FAQs

Alternatives & similar libraries