IIUC this is how VanJS works.
// Create new Ref
const r = van.state(0)
// derive functions as adapt/watch/multiplex.
// Implicitly depends on any Ref it uses and re-runs when they change.
const r2 = van.derive(() => 2 * r.val)
van.derive(() => console.log('r2 is ' + r2.val))
// Changing the value doesn't update r2 or print immediately, it schedules
// a batch update when all derives will get recomputed.
r.val = 3
// ...So 'r2 is 6' won't be printed here.
r.val++
// Refs can be used in a hyperscript-style DOM builder.
// This creates a regular HTMLElement, with a regular Text node where r2 goes,
// but it holds onto that Text node behind the scenes and automatically
// updates it when r2 changes.
const {p} = van.tags
document.appendChild(p("The value is ", r2))
Man I don't even know why I write any code anymore. Everyone's already done everything.