← Lessons

quiz vs the machine

Platinum1780

Frontend

The Signals Reactivity

Fine grained reactive primitives that update only the values that changed.

6 min read · advanced · beat Platinum to climb

What it is

A signal is a reactive primitive holding a value plus the list of consumers that depend on it. Reading a signal subscribes the current computation; writing it notifies subscribers. This enables fine grained updates without diffing a virtual tree.

The primitives

  • Signal: a readable and writable reactive value.
  • Computed: a derived signal that recalculates lazily when its sources change.
  • Effect: runs a side effect and re runs when any read signal updates.

Why fine grained matters

In a virtual DOM model a state change re runs a component and diffs its output. With signals the dependency graph is known precisely, so a change propagates only to the exact effects and DOM bindings that read it. There is no component level re render.

  • Dependencies are tracked at read time.
  • Updates are pushed, then often glitch free via batching.
  • The cost scales with what changed, not tree size.

Key idea

Signals track dependencies at read time so a write propagates only to the exact computeds and effects that use it, avoiding component wide re renders.

Check yourself

Answer to earn rating on the learn ladder.

1. How do signals achieve fine grained updates?

2. What is a computed signal?

3. What does signal based reactivity avoid compared with a virtual DOM?