JavaScript Signals: A Complete Guide to Fine-Grained Reactivity
Learn how signals work under the hood and why nearly every frontend framework now uses them. Build a signals library from scratch, understand push-pull evaluation, the diamond problem, batching, and dynamic dependencies, compare Solid, Vue, Svelte, Angular, and Preact, explore the TC39 Signals proposal, and learn the patterns and pitfalls of reactive state.
Table of Contents
- Introduction
- The Problem Signals Solve
- What a Signal Is
- The Three Primitives: State, Computed, Effect
- Building a Signals Library from Scratch
- Push-Pull Evaluation and the Diamond Problem
- Batching Updates
- Dynamic Dependencies
- Signals vs React’s Rendering Model
- Signals Across Frameworks
- The TC39 Signals Proposal
- Using Signals in React Apps
- Practical Patterns
- Common Pitfalls
- When Not to Use Signals
- Checklist
- Conclusion
Introduction
A few years ago, “signals” was a word you mostly heard from Solid users. Today it describes the reactivity model behind Solid, Vue, Svelte 5, Angular, Preact, Qwik, and a long list of smaller libraries. There is even a TC39 proposal to add signals to JavaScript itself.
The idea is old. Knockout had observables in 2010, and spreadsheets have worked this way for decades: change one cell, and only the cells that depend on it recalculate. What changed is that frameworks figured out how to make this model fast, predictable, and pleasant to use, and that the cost of the alternative, re-running large chunks of UI code on every change, became harder to ignore.
This guide explains signals from the ground up. You will build a working signals library in about 100 lines, see how real implementations avoid glitches and wasted work, compare how each major framework exposes signals, and learn the patterns and mistakes that matter once you use them in a real app.
If you mostly write React, this is still worth your time. React takes a different path, and understanding signals makes it much clearer what tools like the React Compiler are trying to achieve.
The Problem Signals Solve
Every UI framework has to answer one question: when state changes, what needs to update?
There are roughly three ways to answer it:
| Approach | How it decides what to update | Example |
|---|---|---|
| Dirty checking | Re-evaluate every binding and compare with the previous value | AngularJS, Angular + Zone.js |
| Re-render and diff | Re-run the component function, diff the virtual DOM output | React |
| Dependency tracking | Record which state each piece of UI reads, update only those | Solid, Vue, Svelte 5 |
Re-render and diff is simple to reason about: your component is a function of state, and the framework calls it again whenever state changes. The cost is that a change to one value re-runs the whole component, and by default its children, even if only one text node needs to change.
function Dashboard() { const [count, setCount] = useState(0); const [filter, setFilter] = useState("");
// Runs again on every keystroke in the filter input, // even though it only depends on `count` const chart = buildExpensiveChart(count);
return ( <> <input value={filter} onChange={(e) => setFilter(e.target.value)} /> <Chart data={chart} /> <button onClick={() => setCount((c) => c + 1)}>{count}</button> </> );}React’s answer is memoization: useMemo, useCallback, React.memo, and now the compiler that inserts them for you. Signals take the opposite approach. Instead of re-running everything and skipping what didn’t change, they only run what depends on the change in the first place.
What a Signal Is
A signal is a value container that knows who is reading it.
const count = signal(0);
console.log(count.value); // read: 0count.value = 1; // write: notifies everyone who read `count`That looks like a plain object with a getter and setter, and in a way it is. The difference is what happens on read. When you read a signal inside a reactive context (a computed value, an effect, or a component’s render), the signal records that context as a subscriber. When the signal is written, it notifies those subscribers and nobody else.
This is called automatic dependency tracking. You never declare dependencies by hand like you do with a useEffect dependency array. The act of reading is the subscription.
const firstName = signal("Ada");const lastName = signal("Lovelace");
effect(() => { // This effect reads firstName and lastName, so it depends on both console.log(`${firstName.value} ${lastName.value}`);});// logs "Ada Lovelace"
lastName.value = "Byron";// logs "Ada Byron"The Three Primitives: State, Computed, Effect
Almost every signals library is built from three primitives. The names vary, the roles don’t.
| Primitive | Role | Solid | Vue | Svelte 5 | Angular | Preact |
|---|---|---|---|---|---|---|
| State | A writable value | createSignal | ref | $state | signal | signal |
| Computed | A cached value derived from other signals | createMemo | computed | $derived | computed | computed |
| Effect | A side effect that re-runs when inputs change | createEffect | watchEffect | $effect | effect | effect |
Together they form a dependency graph. State signals are the sources, computeds are the intermediate nodes, and effects are the sinks that actually touch the outside world: the DOM, the network, localStorage, the console.
const items = signal([ { name: "Keyboard", price: 120, qty: 1 }, { name: "Mouse", price: 40, qty: 2 },]);const taxRate = signal(0.2);
const subtotal = computed(() => items.value.reduce((sum, item) => sum + item.price * item.qty, 0),);const total = computed(() => subtotal.value * (1 + taxRate.value));
effect(() => { document.querySelector("#total").textContent = total.value.toFixed(2);});items ──► subtotal ──┐ ├──► total ──► effect (DOM)taxRate ─────────────┘Changing taxRate re-evaluates total and the effect, but not subtotal, because subtotal never read taxRate. Nothing else in the app runs at all.
A useful rule of thumb: computeds are for values, effects are for actions. If you find yourself writing an effect that only sets another signal, you probably want a computed.
Building a Signals Library from Scratch
The fastest way to understand signals is to write one. The implementation below is small but handles caching, cleanup of stale dependencies, glitch-free updates, and batching.
The core trick is a single global variable: the current observer. When a computed or effect runs, it sets itself as the current observer. Any signal read during that run sees the observer and subscribes it.
let currentObserver = null;let batchDepth = 0;let flushing = false;const pendingEffects = new Set();
function track(observers) { if (currentObserver) { observers.add(currentObserver); currentObserver.sources.add(observers); }}
function cleanup(node) { // Unsubscribe from everything we read last time for (const observers of node.sources) observers.delete(node); node.sources.clear();}
function runTracked(node, fn) { cleanup(node); const previous = currentObserver; currentObserver = node; try { return fn(); } finally { currentObserver = previous; }}
function flush() { if (batchDepth > 0 || flushing) return; flushing = true; try { for (const node of pendingEffects) { pendingEffects.delete(node); node.run(); } } finally { flushing = false; }}A state signal stores a value and a set of observers. Reading tracks; writing notifies.
export function signal(initialValue) { let value = initialValue; const observers = new Set();
return { get value() { track(observers); return value; }, set value(next) { if (Object.is(next, value)) return; value = next; for (const observer of [...observers]) observer.notify(); flush(); }, peek() { // Read without subscribing return value; }, };}A computed is both an observer (it reads other signals) and an observable (others read it). It is lazy: it only recalculates when someone reads it and it has been marked dirty.
export function computed(fn) { let value; let dirty = true; const observers = new Set();
const node = { sources: new Set(), notify() { if (dirty) return; // already stale, downstream already notified dirty = true; for (const observer of [...observers]) observer.notify(); }, };
return { get value() { track(observers); if (dirty) { value = runTracked(node, fn); dirty = false; } return value; }, };}An effect runs immediately, tracks what it reads, and gets queued whenever any of those dependencies change. It returns a function that disposes it.
export function effect(fn) { const node = { sources: new Set(), notify() { pendingEffects.add(node); }, run() { runTracked(node, fn); }, };
node.run();
return function dispose() { cleanup(node); pendingEffects.delete(node); };}
export function batch(fn) { batchDepth++; try { return fn(); } finally { batchDepth--; flush(); }}That is a complete, usable reactive system:
import { signal, computed, effect, batch } from "./signals.js";
const celsius = signal(20);const fahrenheit = computed(() => (celsius.value * 9) / 5 + 32);
const stop = effect(() => { console.log(`${celsius.value}°C = ${fahrenheit.value}°F`);});// "20°C = 68°F"
celsius.value = 100;// "100°C = 212°F"
stop();celsius.value = 0; // nothing logged, effect is disposedProduction libraries such as @preact/signals-core, Solid, Vue, and alien-signals add a lot on top: version counters instead of re-running computeds whose inputs didn’t actually change, linked lists instead of Sets for memory efficiency, ownership trees for automatic cleanup, and error handling. But the mental model is exactly this.
Push-Pull Evaluation and the Diamond Problem
Look at how a write travels through the library above. It happens in two phases:
- Push: the write walks down the graph, marking computeds dirty and queueing effects. No user code runs yet.
- Pull: queued effects run and read their dependencies. Dirty computeds recalculate on demand, pulling fresh values up the graph.
This push-pull design solves a classic problem in reactive systems called the diamond problem.
a / \ b c \ / d ──► effectconst a = signal(1);const b = computed(() => a.value * 2);const c = computed(() => a.value * 3);const d = computed(() => b.value + c.value);
effect(() => console.log("d =", d.value));// "d = 5"
a.value = 2;A naive push-only system would propagate the change eagerly: a updates b, b updates d, d fires the effect, and only then does a update c. The effect would briefly see d = 4 + 3 = 7, a value that never should have existed, and then fire again with d = 10. That temporary inconsistent state is called a glitch.
With push-pull, the write only marks b, c, and d dirty and queues the effect once. When the effect runs, it reads d, which reads b and c, both recomputed from the new a. The effect fires exactly once with d = 10.
Two properties fall out of this design, and they are what make signals pleasant to work with:
- Glitch-free: you never observe a mix of old and new values
- Lazy: a computed nobody reads never runs, no matter how often its inputs change
const expensive = computed(() => { console.log("computing..."); return heavyCalculation(data.value);});
data.value = newData; // nothing logged, nobody has read `expensive`data.value = newerData; // still nothing
console.log(expensive.value); // "computing..." exactly onceBatching Updates
Each write in the minimal library flushes effects immediately. If you update three signals in a row, an effect that depends on all three runs three times, twice with partially updated state.
const first = signal("Ada");const last = signal("Lovelace");
effect(() => console.log(`${first.value} ${last.value}`));
first.value = "Grace";// "Grace Lovelace" ← intermediate statelast.value = "Hopper";// "Grace Hopper"batch defers the flush until the outermost batch finishes:
batch(() => { first.value = "Grace"; last.value = "Hopper";});// "Grace Hopper", onceFrameworks differ in how much of this they do for you:
- Solid and Preact run effects synchronously and expose
batchfor grouping (Solid also batches automatically inside event handlers and effects) - Vue queues component updates and watchers and flushes them in a microtask, so multiple writes in the same tick are batched by default
- Svelte 5 and Angular schedule effects rather than running them synchronously, which batches writes made in the same task
Automatic scheduling is convenient, but it means the DOM is not updated immediately after a write. Vue gives you nextTick(), Svelte gives you tick(), and Solid’s synchronous model avoids the question entirely. If you need a refresher on microtasks and why they run before rendering, see our guide to the JavaScript event loop.
Dynamic Dependencies
Because dependencies are tracked on every run, they can change between runs. This is one of the biggest practical advantages over manual dependency arrays.
const showDetails = signal(false);const summary = signal("Order #1042");const details = signal("2 items, shipped Tuesday");
effect(() => { if (showDetails.value) { render(details.value); } else { render(summary.value); }});On the first run, the effect reads showDetails and summary. Changing details does nothing, because the effect never read it. After showDetails becomes true, the effect re-runs, the cleanup() call unsubscribes it from summary, and it subscribes to details instead.
This is why the minimal library calls cleanup(node) before every run. Without it, an effect would accumulate subscriptions to every signal it has ever read and re-run far more often than needed.
The flip side: only reads that actually happen are tracked. Short-circuiting and early returns matter.
effect(() => { // If isLoggedIn is false, `user` is never read and never tracked. // That's correct here: the effect only cares about `user` once logged in. if (isLoggedIn.value && user.value.isAdmin) { showAdminPanel(); }});Signals vs React’s Rendering Model
React deliberately does not use signals. Its model is that a component is a function of state, re-run as a whole, with the output diffed against the previous result. Signals frameworks run a component once to set up the reactive graph, and from then on only individual bindings update.
The difference is easiest to see in Solid, which uses JSX like React does:
// Reactfunction Counter() { const [count, setCount] = useState(0); console.log("render"); // logs on every click
return <button onClick={() => setCount(count + 1)}>{count}</button>;}
// Solidfunction Counter() { const [count, setCount] = createSignal(0); console.log("setup"); // logs once, ever
return <button onClick={() => setCount(count() + 1)}>{count()}</button>;}In Solid, the JSX compiles to real DOM creation plus a tiny effect that updates the button’s text node. Clicking the button runs that effect and nothing else. There is no virtual DOM and no diffing.
| Concern | Re-render model (React) | Signals model (Solid, Svelte 5, Vue Vapor) |
|---|---|---|
| Unit of update | Component subtree | Individual binding or DOM node |
| Avoiding wasted work | Memoization (manual or compiler) | Built in through dependency tracking |
| Dependencies | Declared in arrays, or inferred by the compiler | Tracked automatically at runtime |
| Mental model | UI = f(state), re-run on change | Set up once, a reactive graph updates it |
| Stale closures | Common source of bugs | Rare, values are read through getters |
| Debugging | Linear: render, commit, effects | Graph-shaped: “why did this update?” can be harder |
| Ecosystem | Largest | Smaller but growing |
Neither model is strictly better. React’s “just re-run it” model is easy to reason about locally and plays well with features like concurrent rendering and transitions (see our guide to React concurrent features). Signals make fine-grained updates the default and remove a whole category of memoization work, at the cost of a graph you can’t always see.
Signals Across Frameworks
The same three primitives look different in each framework. Here is a small counter with a derived value and an effect, written five ways.
Solid uses getter functions. Calling count() is the read.
import { createSignal, createMemo, createEffect } from "solid-js";
function Counter() { const [count, setCount] = createSignal(0); const doubled = createMemo(() => count() * 2);
createEffect(() => { document.title = `Count: ${count()}`; });
return ( <button onClick={() => setCount((c) => c + 1)}> {count()} × 2 = {doubled()} </button> );}Vue uses .value in script code and unwraps refs automatically in templates.
<script setup>import { ref, computed, watchEffect } from "vue";
const count = ref(0);const doubled = computed(() => count.value * 2);
watchEffect(() => { document.title = `Count: ${count.value}`;});</script>
<template> <button @click="count++">{{ count }} × 2 = {{ doubled }}</button></template>Svelte 5 uses runes, compiler keywords that make plain variables reactive.
<script> let count = $state(0); let doubled = $derived(count * 2);
$effect(() => { document.title = `Count: ${count}`; });</script>
<button onclick={() => count++}>{count} × 2 = {doubled}</button>Angular uses callable signals, like Solid, with .set() and .update() for writes.
import { Component, signal, computed, effect } from "@angular/core";
@Component({ selector: "app-counter", template: ` <button (click)="increment()">{{ count() }} × 2 = {{ doubled() }}</button> `,})export class CounterComponent { count = signal(0); doubled = computed(() => this.count() * 2);
constructor() { effect(() => { document.title = `Count: ${this.count()}`; }); }
increment() { this.count.update((c) => c + 1); }}Preact uses .value, and signals can be passed directly into JSX to update a text node without re-rendering the component.
import { signal, computed, effect } from "@preact/signals";
const count = signal(0);const doubled = computed(() => count.value * 2);
effect(() => { document.title = `Count: ${count.value}`;});
function Counter() { return ( <button onClick={() => count.value++}> {count} × 2 = {doubled} </button> );}A few differences worth knowing:
- Read syntax is either a function call (
count()in Solid and Angular), a property (count.valuein Vue and Preact), or a plain variable (Svelte, where the compiler rewrites it) - Deep reactivity: Vue’s
reactive()and Svelte’s$statewith objects make nested properties reactive through proxies. Solid offers the same through stores (createStore). Angular and Preact signals are shallow, so you replace objects instead of mutating them - Component model: Solid and Svelte 5 run components once. Vue and Angular use signals to decide which components re-render, with finer-grained “Vapor” and zoneless modes pushing them closer to the Solid model
- Where signals live: Preact and Solid let you create signals at module level and share them freely. Svelte 5 requires
.svelte.jsfiles for runes outside components
The TC39 Signals Proposal
Since every framework has its own signals, a reactive value from Vue can’t be read reactively by a Solid component, and every library reimplements the same tricky graph algorithm. The TC39 Signals proposal, developed with input from the authors of Angular, Vue, Solid, Svelte, Preact, Ember, Qwik, and others, aims to fix that by adding a shared core to JavaScript.
It was at Stage 1 when this was written, which means the committee considers the problem worth solving but the design can still change substantially. You can try it today with the signal-polyfill package.
The proposal deliberately provides only the graph, not a full framework API:
import { Signal } from "signal-polyfill";
const counter = new Signal.State(0);const isEven = new Signal.Computed(() => (counter.get() & 1) === 0);const parity = new Signal.Computed(() => (isEven.get() ? "even" : "odd"));
console.log(parity.get()); // "even"counter.set(1);console.log(parity.get()); // "odd"Notice what is missing: there is no effect. Deciding when effects run is a scheduling decision that frameworks make differently, so the proposal exposes a lower-level Signal.subtle.Watcher instead. A framework (or you) builds effects on top of it:
import { Signal } from "signal-polyfill";
let needsEnqueue = true;
const watcher = new Signal.subtle.Watcher(() => { // Called synchronously when a watched signal becomes dirty. // Reading or writing signals here is not allowed, so schedule work instead. if (needsEnqueue) { needsEnqueue = false; queueMicrotask(processPending); }});
function processPending() { needsEnqueue = true; for (const signal of watcher.getPending()) { signal.get(); } watcher.watch(); // re-arm the watcher}
export function effect(callback) { let cleanup; const computed = new Signal.Computed(() => { cleanup?.(); cleanup = callback(); }); watcher.watch(computed); computed.get();
return () => { cleanup?.(); watcher.unwatch(computed); };}The goal is not that application developers write this code. It’s that frameworks build on a shared, engine-optimized primitive, so that a signal created in one library can be tracked by another, and DevTools can visualize the graph regardless of which framework you use.
Treat the proposal as something to watch, not something to ship. The polyfill is useful for learning and experiments, but framework-provided signals are what you should use in production today.
Using Signals in React Apps
You can use signals inside React, with some caveats.
Preact Signals for React (@preact/signals-react) is the most common option. Components that read signals need to be tracked, either through a Babel plugin (@preact/signals-react-transform) that instruments components automatically or by calling the useSignals() hook at the top of the component.
import { signal, computed } from "@preact/signals-react";import { useSignals } from "@preact/signals-react/runtime";
const todos = signal([]);const remaining = computed(() => todos.value.filter((t) => !t.done).length);
function addTodo(text) { todos.value = [ ...todos.value, { id: crypto.randomUUID(), text, done: false }, ];}
function TodoCounter() { useSignals(); return <p>{remaining.value} items left</p>;}Because todos and remaining live outside any component, they behave like a tiny global store. Only components that read them re-render when they change.
Things to keep in mind:
- It works around React, not with it. Signals updates are not part of React’s concurrent rendering or transitions, so features like
useTransitiondon’t apply to them in the same way - React state is still the default in the ecosystem. Libraries, docs, and teammates expect
useStateand friends - The same benefits are available elsewhere. Stores with selectors, such as Zustand, Jotai’s atoms, or
useSyncExternalStore, already give you “only re-render what reads this” semantics. Jotai in particular is very close to signals in spirit. Our guide to React state management compares these options - The React Compiler reduces the main pain point signals address in React, unnecessary re-renders, without changing the programming model
If you are already on React, signals are a reasonable choice for a specific hot path, such as a live-updating dashboard or a high-frequency data feed. For an entire app, the friction usually outweighs the benefit.
Practical Patterns
Derive, Don’t Sync
The most common mistake with any reactive system is copying state with an effect.
// ❌ Two sources of truth, kept in sync by an effectconst items = signal([]);const count = signal(0);
effect(() => { count.value = items.value.length;});
// ✅ One source of truth, one derived valueconst items = signal([]);const count = computed(() => items.value.length);The computed version is lazy, glitch-free, and can’t get out of sync. The effect version runs eagerly, adds a scheduling delay, and in some frameworks triggers a warning about writing to signals inside effects.
Encapsulated Stores
Signals compose well into small stores that expose read-only state and named actions:
import { signal, computed, batch } from "./signals.js";
export function createCart() { const items = signal([]); const discount = signal(0);
const subtotal = computed(() => items.value.reduce((sum, item) => sum + item.price * item.qty, 0), ); const total = computed(() => Math.max(0, subtotal.value - discount.value));
return { // Expose computeds for reading, keep raw signals private items: computed(() => items.value), subtotal, total,
add(product) { const existing = items.value.find((item) => item.id === product.id); items.value = existing ? items.value.map((item) => item.id === product.id ? { ...item, qty: item.qty + 1 } : item, ) : [...items.value, { ...product, qty: 1 }]; },
applyCoupon(amount) { discount.value = amount; },
clear() { batch(() => { items.value = []; discount.value = 0; }); }, };}Because the store isn’t tied to any component, it can be unit tested with plain function calls, no rendering required.
Async Resources
Signals are synchronous, but async data fits in naturally when you model loading, data, and error as separate signals. The request ID guards against out-of-order responses when the input changes quickly.
export function resource(source, fetcher) { const data = signal(undefined); const error = signal(undefined); const loading = signal(false); let latestRequest = 0;
const dispose = effect(() => { const input = source.value; // tracked: re-fetch when it changes const requestId = ++latestRequest; loading.value = true;
fetcher(input).then( (result) => { if (requestId !== latestRequest) return; // stale response batch(() => { data.value = result; error.value = undefined; loading.value = false; }); }, (err) => { if (requestId !== latestRequest) return; batch(() => { error.value = err; loading.value = false; }); }, ); });
return { data, error, loading, dispose };}
// Usageconst userId = signal(1);const user = resource(userId, (id) => fetch(`/api/users/${id}`).then((res) => res.json()),);
userId.value = 2; // automatically fetches user 2Frameworks ship polished versions of this: Solid’s createResource, Angular’s resource() and httpResource(), and Vue’s ecosystem libraries. For serious data fetching with caching, deduplication, and background refetching, a dedicated library such as TanStack Query is still the better tool, and it has adapters for Solid, Vue, Svelte, and Angular.
Untracked Reads
Sometimes an effect needs a value without depending on it. Every library has an escape hatch: peek() in Preact, untrack() in Solid and Svelte, untracked() in Angular.
effect(() => { // Log every page view, including the current user, // but don't re-log when the user object changes analytics.track("page_view", { path: currentPath.value, userId: currentUser.peek()?.id, });});Common Pitfalls
1. Mutating Instead of Replacing
Shallow signals compare with Object.is. Mutating an object or array in place keeps the same reference, so nothing updates.
const todos = signal([]);
// ❌ Same array reference, no notificationtodos.value.push({ text: "Write post" });
// ✅ New array, subscribers notifiedtodos.value = [...todos.value, { text: "Write post" }];Deeply reactive APIs (Vue’s reactive, Svelte’s $state objects, Solid stores) handle mutation through proxies, so know which kind of signal you are holding.
2. Reading Outside a Tracking Context
Dependencies are only tracked while the computed or effect is running synchronously. Anything read after an await or inside a callback is not tracked.
// ❌ `filter` is read after the await, so it is not a dependencyeffect(async () => { const data = await fetchData(); render(data.filter((item) => item.type === filter.value));});
// ✅ Read tracked values before any async workeffect(() => { const currentFilter = filter.value; fetchData().then((data) => render(data.filter((item) => item.type === currentFilter)), );});3. Destructuring Away Reactivity
Pulling a value out of a signal turns it into a plain, static value.
// Solidfunction Greeting(props) { const { name } = props; // ❌ read once at setup, never updates return <p>Hello {name}</p>;}
function Greeting(props) { return <p>Hello {props.name}</p>; // ✅ read inside the JSX binding}The same applies to Vue’s reactive() objects (use toRefs) and to passing count.value instead of count into a function that should stay reactive.
4. Infinite Loops
An effect that reads and writes the same signal can trigger itself forever.
// ❌ Reads count, writes count, re-runs, reads count...effect(() => { count.value = count.value + 1;});Most frameworks detect this and throw, but the fix is always the same: derive with a computed, or read with peek()/untrack() if you really need the previous value.
5. Leaking Effects
An effect stays subscribed until it is disposed. Inside a component, frameworks dispose effects automatically when the component unmounts. Effects created at module level or in long-lived stores are your responsibility.
// In a router or view lifecycleconst dispose = effect(() => syncToUrl(filters.value));
onLeave(() => dispose());6. Overusing Effects
Effects are the least predictable part of the graph. Prefer this order:
- Computed for anything derived from state
- Event handlers for anything triggered by user actions
- Effects only for synchronizing with external systems (DOM APIs, subscriptions, storage)
This is the same advice React gives for useEffect, and it applies just as strongly to signals.
When Not to Use Signals
Signals are a good default for UI state, but they are not free and not always the right tool.
- Infrequently updated, mostly static UI. If a page changes once per navigation, the difference between fine-grained and coarse updates is unmeasurable
- Your framework already has a model. Adding signals to a React app introduces a second reactivity system with different rules. Use them where they clearly help, not everywhere
- Server state. Signals don’t cache, deduplicate, or revalidate network data. Use a data-fetching library and expose its results as signals if you like
- Event streams. Signals hold the current value. If you care about every event in order, such as keystrokes for an undo log or messages from a socket, an event emitter, async iterator, or RxJS observable is a better fit. Angular’s
toSignalandtoObservableexist precisely because both models are useful - Huge graphs with heavy fan-out. Thousands of fine-grained subscriptions have a memory cost. Sometimes a single coarse signal holding an immutable object is simpler and faster than one signal per field
Checklist
Conclusion
Signals answer the “what needs to update?” question by tracking dependencies as code runs. Instead of re-running components and filtering out wasted work, they build a graph of state, derived values, and effects, and update only the parts of that graph a change actually reaches.
Key Takeaways:
- A signal is a value that records who reads it, so dependencies are tracked automatically
- Three primitives, state, computed, and effect, form a dependency graph in every signals library
- Push-pull evaluation marks nodes dirty first and recomputes lazily, which avoids glitches and the diamond problem
- Computeds are lazy and cached: they never run unless something reads them
- Dynamic dependencies mean effects only subscribe to what they read on their latest run
- Solid, Vue, Svelte 5, Angular, and Preact all use signals, with different syntax and different levels of deep reactivity
- React takes a different approach, re-rendering and memoizing, and the React Compiler narrows the performance gap
- The TC39 Signals proposal aims to standardize the graph, not the framework API, and is still early
- Most bugs come from mutating shallow signals, reading after
await, destructuring, and overusing effects
The best way to internalize all this is to build the 100-line library above and break it. Remove the cleanup() call and watch effects fire too often. Remove the dirty check in computed and watch it recompute on every read. Once you’ve seen why each piece is there, the behavior of every framework’s signals becomes predictable.
For more on related topics, check out our guides on the React Compiler, state management in React, and the JavaScript event loop.