@jorvel/state
v0.2.0
Published
Lightweight shared-state primitives for JORVEL micro-frontends (Redux-style store + simple observable store).
Maintainers
Readme
@jorvel/state
Lightweight shared-state primitives for JORVEL micro-frontends. Provides:
createStore(initialState, reducer)— Redux-style reducer store withsubscribe,dispatch,getState.createSimpleStore(initial)— observable single-value store withset,get,subscribe.getStore(key, ...)/getSimpleStore(key, ...)— globally-shared registries pinned toglobalThisfor safe cross-MFE singleton sharing.'@jorvel/state/react'—useStore,useStoreSelectoradapters built onuseSyncExternalStore.
Install
pnpm add @jorvel/stateWhy
When @jorvel/state is bundled multiple times (e.g. when the federation runtime fails to share it as singleton), every host/remote ends up with its own private registry — state silently bifurcates. The registries here are pinned to globalThis.__JORVEL_STATE_REGISTRY__ so duplicate bundles still see the same Map.
See the repo root README for the full framework story.
