From 770b1073dc492c55830cfb7740aaca18590672d0 Mon Sep 17 00:00:00 2001 From: Natxo <1172351+natxocc@users.noreply.github.com> Date: Tue, 31 Mar 2026 10:32:02 +0200 Subject: [PATCH] Update Readme.md --- Readme.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Readme.md b/Readme.md index 18879a4..5e317ce 100644 --- a/Readme.md +++ b/Readme.md @@ -37,18 +37,14 @@ const Counter = () => { const value = $(100); // One-line persistence: state survives page reloads automatically const count = $(0, "user-counter-pref"); - // Computed: automatically updated when value changes - const doubleValue = $(()=> value() *2); + // Computed: automatically updated when count() or value() changes + const doubleValue = $(()=> value() *count()); // Create fast HTML with pure JS return Div({ class: "card" }, [ - H1(`Count: ${count()}`), - doubleValue() + H1(`Count: ${count()}, Reference: ${value()}, Double x Ref: ${doubleValue()}`), P("Atomic updates. Zero re-renders of the parent tree."), - Button({ - onclick: () => count(c => c + 1), - class: "btn-primary" - }, "Increment +1") + Button({ onclick: () => count(c => c + 1)}, "Increment +1") ]); };