JavaScript Signals: The Future of Reactivity
Fine-grained reactivity coming to JavaScript itself
JavaScript Signals: The Future of Reactivity
Signals are everywhere — Vue, Solid, Angular, Svelte, Preact. Now they're coming to JavaScript itself.
What Are Signals?
Signals are reactive primitives. When a signal's value changes, anything that depends on it updates automatically.
// Create a signalconst count = new Signal.State(0);
// Read itconsole.log(count.get()); // 0
// Update itcount.set(1);count.set(prev => prev + 1);Computed Values
Derived values that auto-update:
const count = new Signal.State(0);const doubled = new Signal.Computed(() => count.get() * 2);
console.log(doubled.get()); // 0
count.set(5);console.log(doubled.get()); // 10 (auto-updated!)Why Signals Beat useState
React re-renders entire components. Signals update only what changed.
// React: Component re-renders on any state changefunction Counter() { const [count, setCount] = useState(0); return <button onClick={() => setCount(c => c + 1)}>{count}</button>;}
// Signals: Only the text node updatesfunction Counter() { const count = new Signal.State(0); return ( <button onClick={() => count.set(c => c + 1)}> {count} {/* Only this updates */} </button> );}Effects (Reactions)
Run code when signals change:
const name = new Signal.State("John");
// Effect runs when dependencies changeconst effect = new Signal.subtle.Watcher(() => { console.log(`Name changed to: ${name.get()}`);});
effect.watch();
name.set("Jane"); // Logs: "Name changed to: Jane"The TC39 Proposal
Signals are being standardized for JavaScript:
// Proposed API (may change)import { Signal } from "std:signal";
const state = new Signal.State(initialValue);const computed = new Signal.Computed(() => derivedValue);Framework Implementations
Every major framework has signals now:
// Vue 3const count = ref(0);
// Solidconst [count, setCount] = createSignal(0);
// Angularconst count = signal(0);
// Preact Signalsconst count = signal(0);
// Svelte 5 (Runes)let count = $state(0);Benefits
1. Fine-Grained Updates
// Only the specific DOM node updates// Not the entire component tree2. No Stale Closures
// Signals always have current value// No dependency arrays needed3. Better Performance
// Less work = faster updates// Especially in large apps4. Simpler Mental Model
const a = new Signal.State(1);const b = new Signal.State(2);const sum = new Signal.Computed(() => a.get() + b.get());
// sum always equals a + b// No manual synchronizationWhen Will It Land?
The TC39 proposal is at Stage 1. Estimated timeline:
- 2025: Stage 2/3
- 2026-2027: Stage 4 (finalized)
- 2027+: Browser implementation
Use Signals Today
Don't wait — use a library:
// @preact/signals-core (framework-agnostic)import { signal, computed, effect } from "@preact/signals-core";
const count = signal(0);const doubled = computed(() => count.value * 2);
effect(() => { console.log(count.value);});The Takeaway
Signals solve React's re-rendering problem at the language level. When JavaScript gets native signals, reactivity will be faster and simpler everywhere.
Start learning signals now — they're the future.
Stay Updated 📬
Get the latest tips and tutorials delivered to your inbox. No spam, unsubscribe anytime.