Build a Reactivity Engine
Interactive lab

60 min

Render Block

Build createBlock and text() to bind signal values to DOM nodes.

~/playground — 06-render-block · edit renderer.js

Live
import { createEffect } from './engine.js'

export function createBlock(renderFn) {
  // TODO: run renderFn inside createEffect
  throw new Error('Not implemented')
}

export function text(node, getValue) {
  // TODO: bind node.textContent to getValue()
  throw new Error('Not implemented')
}

Preview goal: Clicking +1 updates the counter text in the preview.

Checkpoints

  • text() updates DOM when signal changes
  • All Sandpack tests pass