Under The Hood
frontend solidjs SolidJS 1.x

createSignal: Publisher-Subscriber Node Tracking Graphs

Last updated
Prerequisites:
SolidJS basics (createSignal, JSX)
Understanding of reactive programming concepts
  • solidjs
  • signals
  • createSignal
  • reactivity
  • fine-grained
  • tracking

Read at your depth

The practical view

const [count, setCount] = createSignal(0) returns a getter (count) and a setter (setCount). Read count() to get the value; call setCount(1) or setCount(c => c + 1) to update. Any code that reads count() inside a reactive context (JSX, createEffect, createMemo, createComputed) automatically re-runs when the value changes. This is 'fine-grained reactivity': only the exact consumers of count re-execute, not the whole component. Unlike React, the component function itself does NOT re-run — the JSX expressions that read count() are the reactive nodes.

The same idea in other frameworks

react equivalent
const [count, setCount] = useState(0) re-renders the whole component; Solid's signal only re-runs the exact expressions reading it.

Legacy vs modern

Component re-render vs fine-grained signal updates

A component-wide re-render re-executes everything; Solid's signals re-run only the expressions that read the changed value, with no diffing.

before → after
Component-wide re-render (state-based)
const [count, setCount] = useState(0); // ❌ OLD: setCount re-renders the whole component
Fine-grained signal update
const [count, setCount] = createSignal(0); // ✅ NEW: only expressions reading count() re-run

Interview gotchas

Context

This is the defining architectural question of Solid — interviewers want the compiled fine-grained model vs the component-as-render-function model, not just 'Solid is faster'.

The mechanical answer

In Solid, JSX is compiled at build time into granular computation nodes: each expression that reads a signal becomes its own reactive computation wired into the DOM update path. The component function is a plain setup function that runs once to create those nodes and returns a template/mounting description; it is never re-executed. When a signal changes, only the computations that registered that signal as a dependency are invalidated and re-run, updating the exact DOM nodes they own. React, by contrast, treats the component function as the render unit: every state change re-runs the whole function and diffs. Solid's model trades the render-function abstraction for precision, which is why it has no Virtual DOM and no reconciliation of the component tree.

Trap

The naive answer is 'Solid is just faster React'. The models differ fundamentally: Solid components are setup functions, not render functions — writing component logic that assumes re-execution (e.g. re-deriving state from props inside the body) behaves differently. Another trap: thinking JSX variables are reactive — only signal reads inside compiled expressions are tracked; a variable computed once and read in JSX does not update unless it is a memo or reads a signal inside the expression. Candidates who explain the compile-time transformation show real understanding.

Under The Hood — a multi-depth technical interview hub.

Third-party licenses Press ⌘ K to search.