Skip to content

Reactive primitives

@starbeam/reactive exposes primitive reactive values for authors building Starbeam primitives, adapters, and integration layers. It is not the normal starting point for app state.

Most app and library models should start with @starbeam/collections, @starbeam/universal, or a framework adapter.

Terminal window
pnpm add @starbeam/reactive
ExportUse for
CellStore one reactive value inside a primitive.
MarkerMark external storage as reactive without storing the value.
FormulaCompute a reactive value every time it is read.
CachedFormulaCache a reactive computation until one of its reads changes.
StaticWrap a non-changing value as reactive.
readRead either a reactive value or a plain value.
CellOptions, Equality, FormulaFn, ReadValueHelper types for primitive authors.

Use these APIs when the public value you are building is itself a reactive primitive or low-level abstraction. For ordinary app state, prefer reactive objects and collections.

@starbeam/reactive also exports lower-level APIs used by Starbeam adapters, runtime packages, and debug setup:

  • tracking frames such as StartTrackingFrame, startFrame, and finishFrame;
  • runtime and debug registration such as defineRuntime, defineDebug, DEBUG, and UNKNOWN_REACTIVE_VALUE;
  • protocol helpers such as isReactive, isTagged, intoReactive, and isFormulaFn.

These remain exported for compatibility. They are not the app-facing primitive path.