valtio
by
pmndrs

Description: 🧙 Valtio makes proxy-state simple for React and Vanilla

View on GitHub ↗

Summary Information

Updated 56 minutes ago
Added to GitGenius on January 9th, 2022
Created on November 16th, 2020
Open Issues & Pull Requests: 5 (+0)
Number of forks: 288
Total Stargazers: 10,201 (+0)
Total Subscribers: 35 (+0)

Issue Activity (beta)

Open issues: 3
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 815 days
Stale 30+ days: 3
Stale 90+ days: 2

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • help wanted (11)
  • needs repro (5)
  • enhancement (4)
  • good first issue (3)
  • documentation (2)
  • on hold (1)
  • wontfix (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Repository Insights (GitGenius)

Median issue/PR response: 462.8 days
Mean response time: 535.8 days
90th percentile: 1327.3 days
Tracked items: 19

Most active contributors

Detailed Description

Valtio is a state management library that simplifies proxy-based state handling for both React and vanilla JavaScript applications. The library is maintained by the pmndrs organization and is written in TypeScript, with its primary purpose being to make mutable state management intuitive and performant through JavaScript proxies.

The core concept of Valtio is straightforward: it wraps a JavaScript object into a self-aware proxy that can be mutated directly like a normal object, without requiring immutable update patterns or complex state management boilerplate. Developers can make changes to the state from anywhere in their application using standard JavaScript mutation syntax. For React integration, Valtio provides the useSnapshot hook, which creates a local snapshot of the state that tracks changes and triggers re-renders only when the specific parts of state accessed in the render function have changed. This approach provides render optimization by detecting property access through an internal proxy mechanism based on proxy-compare technology.

Beyond React, Valtio supports vanilla JavaScript usage, allowing developers to subscribe to state changes from anywhere in their application, including outside of components. The library includes utilities like subscribeKey for subscribing to primitive values and watch for convenient state observation. Valtio is compatible with React 19's use hook for suspending components, though it notes potential de-optimization issues with useTransition that can be addressed through the third-party use-valtio library.

The library offers several advanced features for different use cases. The ref utility allows developers to hold objects in state without proxy tracking, useful for large nested objects with accessors. Valtio supports transient updates for frequently occurring state changes without triggering re-renders, and developers can control whether mutations are batched or synchronous depending on their needs. The library integrates with Redux DevTools Extension for debugging and state manipulation in plain objects and arrays.

Valtio includes specialized utilities like proxySet and proxyMap that mimic native Set and Map behavior while maintaining proxy reactivity. The useProxy utility provides a convenient abstraction for beginners by returning both shallow proxy state and its snapshot together. Computed properties can be defined using object getters for advanced use cases, though the library notes that this requires careful handling of the this context.

According to GitGenius activity tracking, the repository shows median issue and pull request response latency of approximately 11,106 hours with a mean of 12,859 hours across 19 tracked items. The most active contributor tracked is dai-shi with 22 events, followed by overthemike with 7 events and sethyuan with 2 events. The repository is classified across multiple domains including frontend development, state management, reactive programming, and browser-based applications, with connections to related projects like jotai and opencode through overlapping contributors.

Valtio v2 requires React 18 and up and works with various renderers including react-dom, react-native, and react-three-fiber. The library is framework-agnostic and functions in Node.js, Next.js, and other environments. The ecosystem includes eslint-plugin-valtio for linting support and community-contributed recipes covering state organization, persistence, context integration, and state composition patterns.

valtio
by
pmndrspmndrs/valtio

Repository Details

Fetching additional details & charts...