Enhance Readme with code examples

Added example HTML and JavaScript code snippets to illustrate reactive components.
This commit is contained in:
Natxo
2026-03-31 10:24:22 +02:00
committed by GitHub
parent e509cf3e5d
commit c4005a903d

View File

@@ -27,13 +27,23 @@ While other frameworks "guess" what changed by comparing massive DOM trees (Diff
Create reactive, persistent components with a syntax that feels like Vanilla JS, but works like magic:
```html
<div id="app"></div>
```
```javascript
const Counter = () => {
// Simple signal
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);
// Create fast HTML with pure JS
return Div({ class: "card" }, [
H1(`Count: ${count()}`),
dobleValue()
P("Atomic updates. Zero re-renders of the parent tree."),
Button({
onclick: () => count(c => c + 1),