Update Readme.md
This commit is contained in:
12
Readme.md
12
Readme.md
@@ -37,18 +37,14 @@ const Counter = () => {
|
|||||||
const value = $(100);
|
const value = $(100);
|
||||||
// One-line persistence: state survives page reloads automatically
|
// One-line persistence: state survives page reloads automatically
|
||||||
const count = $(0, "user-counter-pref");
|
const count = $(0, "user-counter-pref");
|
||||||
// Computed: automatically updated when value changes
|
// Computed: automatically updated when count() or value() changes
|
||||||
const doubleValue = $(()=> value() *2);
|
const doubleValue = $(()=> value() *count());
|
||||||
|
|
||||||
// Create fast HTML with pure JS
|
// Create fast HTML with pure JS
|
||||||
return Div({ class: "card" }, [
|
return Div({ class: "card" }, [
|
||||||
H1(`Count: ${count()}`),
|
H1(`Count: ${count()}, Reference: ${value()}, Double x Ref: ${doubleValue()}`),
|
||||||
doubleValue()
|
|
||||||
P("Atomic updates. Zero re-renders of the parent tree."),
|
P("Atomic updates. Zero re-renders of the parent tree."),
|
||||||
Button({
|
Button({ onclick: () => count(c => c + 1)}, "Increment +1")
|
||||||
onclick: () => count(c => c + 1),
|
|
||||||
class: "btn-primary"
|
|
||||||
}, "Increment +1")
|
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user