# Reactive Signals

Signals are a reactive primitive that holds a value and automatically notifies dependents when that value changes. They've become the dominant reactivity model in modern JavaScript frameworks, replacing or supplementing older approaches like virtual DOM diffing and observable streams.

## How they work

A signal wraps a value with a getter and setter. Reading the value is tracked; writing to it triggers notifications. Derived values (computeds) subscribe automatically by reading signals during their evaluation — no manual dependency arrays required. The underlying algorithm is **push-pull**: signals eagerly push invalidation (marking dependents dirty), but dependents lazily pull new values only when read. See [[signal-push-pull-algorithm]] for a full implementation walkthrough.

## Why they exist

The problem signals solve is keeping derived state in sync with source state without manual wiring. A spreadsheet does this naturally — change a cell and formulas update. Signals bring the same model to application state.

Earlier reactive approaches in JavaScript had tradeoffs:
- **Virtual DOM diffing** (React) re-renders entire component subtrees, relying on memoization to avoid waste
- **Observable streams** (RxJS) are powerful but verbose for simple derived state
- **Manual dependency arrays** (React hooks) are error-prone — forget a dep and you get stale closures

Signals track dependencies automatically at read time, update at fine granularity (individual values, not component trees), and skip recomputation when nothing reads the result.

## Framework adoption

Solid was the first major framework built entirely on signals. Vue's `ref()` and `computed()` are signals under a different name. Preact added `@preact/signals`. Angular introduced signals in v16. Svelte 5's runes compile down to a signal-like system.

## Standardization

The TC39 proposal-signals (Stage 1) would add a native `Signal` primitive to JavaScript. Frameworks could then share the subscription and invalidation layer while keeping their own APIs. See [[tc39-proposal-signals]].
