Skip to content
Signals & Fine-Grained Reactivity
step 1/5

Reading — step 1 of 5

Read

~1 min readHooks & State

Hooks recompute the entire component on every state change, then diff. Signals take a different path: each piece of state tracks its own dependents, and updates trigger only the effects that actually read that state — never a full re-render.

This is the model Solid, Vue 3 (refs), Svelte 5 (runes), Angular Signals, and Preact Signals all use.

The mechanics:

  1. Creating a signal stores its value plus an empty list of "subscribers".
  2. Reading a signal inside an effect registers the effect as a subscriber.
  3. Writing a signal marks every subscriber as "dirty".
  4. Flushing runs every dirty effect once (in declaration order), then clears the dirty set.

In this exercise you simulate that flow with explicit READS declarations (no automatic dependency tracking) so the focus stays on the scheduler.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…