Legend-State: fine-grained reactivity with built-in persistence for React and React Native
Legend-State is a super fast and powerful state library that enables fine-grained reactivity and easy automatic persistence
At a glance
- What is it?
- Legend-State is an MIT-licensed TypeScript state library that skips reducers and contexts in favour of observables you call get() and set() on. It ships persistence and sync plugins, but package.json still declares version 3.0.0-beta.48.
- Who is it for?
- Adopt Legend-State if you are building a React or React Native app that needs fine-grained reactivity plus local-first persistence, and you can accept a beta dependency: package.json pins version 3.0.0-beta.48. Do not adopt it if you need a stable release line or a non-React runtime, because the documented entry points are the React, React Native and sync modules.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 2 days ago.
- What is it written in?
- Mainly TypeScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.
Star history
- LegendApp/legend-state4,224 ★ · +13
| Repository | 2026-09-23 | 2026-11-22 |
|---|---|---|
| LegendApp/legend-state | 4.2k | 4.2k |
13 Stars in the last 60 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The problem Legend-State targets: state that re-renders too much and syncs by hand
Most React state libraries ask you to describe changes as actions, and then wire a separate layer to persist or sync those changes. Legend-State collapses both jobs into one observable tree. The README states its four goals plainly: no boilerplate, speed, fine-grained reactivity, and sync with persistence. The audience is React and React Native developers who already feel the cost of re-rendering a whole subtree because one field changed, and who would otherwise hand-roll a queue for offline writes.
According to the README, it "doesn't modify your data at all", and you read with get() and write with set(). That is a meaningful design choice: get() returns the raw data, so serialising it, logging it or handing it to a non-React function needs no conversion step. The trade-off is that you have to call get() inside an observing context for tracking to happen.
How observables, computed values and observers actually connect
An observable is a tree. Calling observable() on an object returns a node whose children are themselves observable nodes, which is why settings$.theme.get() works without declaring a schema. A plain function passed to observable() becomes a computed node: the README shows observable(() => settings$.theme.get() === 'dark'), which re-evaluates when the tracked theme changes.
Tracking is dynamic, not declared. An observing context, whether observe() or a component wrapped in observer, records which observables were read during its last run and re-runs when any of them change. This is why the README example can write a computed value with no dependency array. The cost is that a conditional read is also a conditional dependency: if a branch is not taken on one run, that observable is not tracked on that run. The README does not describe a way to declare a dependency eagerly, so correctness depends on the code path staying stable.
For rendering, the README offers two levels. observer re-renders the component when a tracked value changes. Memo pushes further: in the FineGrained example, Count: <Memo>{count$}</Memo> lets the text node update itself so the component around it does not re-render. That is where the fine-grained claim becomes concrete, and it is also where the mental model shifts, because you are now deciding which parts of the tree are allowed to update independently.
Installing Legend-State and writing a first persisted observable
The README gives three package managers. Pick whichever your project already uses; the package name is the same in all three.
bun add @legendapp/statenpm install @legendapp/stateyarn add @legendapp/stateNote the engines field in package.json: node >=16.6.0 and npm >=8.11.0. After installing, the smallest useful program is an observable plus an observer component. This is adapted from the README's first example.
import { observable, observe } from "@legendapp/state"
import { observer } from "@legendapp/state/react"
const settings$ = observable({ theme: 'dark' })
settings$.theme.get() // 'dark'
settings$.theme.set('light')
const Component = observer(function Component() {
const theme = settings$.theme.get()
return <div>Theme: {theme}</div>
})Calling set('light') should re-render Component, because observer tracked the theme read. If nothing re-renders, the usual cause is reading the observable outside an observing context, for example in an event handler at module scope.
The persistence story starts with a plugin. The README's sync example wires a syncedKeel node with persist: { name: 'users', retrySync: true }, debounceSet: 500, retry: { infinite: true } and changesSince: 'last-sync'. The comment in that example is the part worth reading twice: "get() activates through to state$.users and starts syncing". Sync is lazy. A tree that is never read never syncs, which is efficient but also means a typo in a path can silently produce a node that does nothing.
Where Legend-State is the wrong tool
The version number is the first constraint. package.json declares 3.0.0-beta.48, and the publish scripts include publish:betarelease with --tag beta. If your release process requires a stable semver line, this is not it yet. The README does not document a rollback or migration path between beta releases; the CHANGELOG file exists in the repository, so that is where upgrade risk has to be checked rather than in the README.
The second constraint is the runtime. The documented entry points are react.ts, react-native.ts, react-web.ts and sync.ts at the repository root. There is no documented Vue, Svelte or plain-DOM binding, so a non-React application would be using the core observable without the rendering integration that makes the fine-grained story pay off.
The third is the sync plugins themselves. The README lists Keel, Supabase, TanStack Query and fetch. If your backend is not on that list, you are writing a custom plugin, and the README does not walk through that. Also note that four plugins is a short list compared with what a dedicated sync engine offers; the README presents them as included conveniences, not as a general protocol.
How Legend-State differs from Zustand and Redux
Zustand and Redux both centre on a store you update through a function. Redux formalises this with actions, reducers and a dispatcher; Zustand trims it to a store plus set calls. In both, persistence is an add-on: Redux needs middleware such as redux-persist, and Zustand ships a persist middleware. Neither is designed around a reactive graph that tracks reads automatically.
Legend-State inverts the unit of change. There is no store object to select from; there are observable nodes, and an observer tracks whichever nodes it read. The README explicitly lists what is absent: "no contexts, actions, reducers, dispatchers, sagas, thunks, or epics". Persistence is not middleware bolted on afterwards; it is a property of the observable node, declared inline as persist: { name: 'users' } alongside the sync functions.
That difference has a practical consequence. With Zustand or Redux, you can read state from anywhere without an observing context and get a snapshot. With Legend-State, reading outside an observing context gives you the value but establishes no subscription, and writing through a computed path such as me: () => state$.users['myuid'] requires the path to resolve. The library is less forgiving of ad-hoc access, and in exchange it does less work per render.
Maintenance, licence and the cost of staying on a beta
The repository is not archived and the last push was on 2026-10-10, so it is being worked on. The README names Jay Meistrich as creator and maintainer, with Legend and Bravely as the products that depend on it. That is a real signal about commitment, though it is also a single-maintainer project by the README's own description.
The upgrade cost sits in the beta cadence. The publish scripts show distinct tags for alpha, beta, next and rc, so releases move through channels rather than landing as stable versions. The preversion script runs the test suite before a version bump, and postversion runs the build and pushes tags, so the release path is automated. What is not automated, from the README's perspective, is telling you what changed: the repository carries a CHANGELOG.md, and that is the file to read before bumping.
The licence is MIT, which permits commercial use, modification and redistribution provided the copyright notice and permission notice are included. That is the whole of the grant; the README gives no additional patent or trademark terms, and nothing here should be read as legal advice. If your organisation has a policy on beta dependencies, the version string in package.json is the fact that policy has to be checked against.
Editorial conclusion
Adopt Legend-State if you are building a React or React Native app that needs fine-grained reactivity plus local-first persistence, and you can accept a beta dependency: package.json pins version 3.0.0-beta.48. Do not adopt it if you need a stable release line or a non-React runtime, because the documented entry points are the React, React Native and sync modules. Before committing, verify that the sync plugin you need (Keel, Supabase, TanStack Query or fetch) is still exported from sync.ts, and check the CHANGELOG for breaking changes between beta releases.
Frequently asked questions
What is Legend-State?
It is an MIT-licensed TypeScript state and sync library for React and React Native. The README describes it as having four goals: ease of use with no boilerplate, speed, fine-grained reactivity, and sync with persistence.
How does Legend-State compare with Jotai?
The README does not mention Jotai. What the README does say is that Legend-State has no contexts, actions, reducers or dispatchers, and that observables are read with get() and written with set().
How does Legend-State compare with Redux?
Redux is organised around actions and reducers, which the README lists among the things Legend-State omits. Legend-State instead exposes an observable tree, and persistence is declared on the observable node rather than added through middleware.
How does Legend-State compare with MobX?
The README does not describe MobX. The design point the README does state is that Legend-State "doesn't modify your data at all", with get() returning the raw data.
What are alternatives to Legend-State?
The README does not list alternatives. It does name the sync plugins it ships with, Keel, Supabase, TanStack Query and fetch, which is the closest thing in the README to a set of adjacent tools.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/legendapp-legend-state)Star history chart for your README
[](https://hysenlabs.com/projects/legendapp-legend-state)Was this useful?