1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-01-18 07:23:15 +01:00

better helloWorld.js

This commit is contained in:
Jan Andrle 2024-12-13 19:37:52 +01:00
parent c391c6549b
commit e884f871b0
Signed by: jaandrle
GPG Key ID: B3A25AED155AFFAB

View File

@ -1,15 +1,19 @@
import { el } from "deka-dom-el";
import { S } from "deka-dom-el/signals";
const clicks= S(0); // A
document.body.append(
el().append(
const threePS= ({ emoji= "🚀" })=> {
const clicks= S(0); // A
return el().append(
el("p", S(()=>
"Hello World "+"🎉".repeat(clicks()) // B
"Hello World "+emoji.repeat(clicks()) // B
)),
el("button", {
type: "button",
onclick: ()=> clicks(clicks()+1), // C
textContent: "Fire",
})
)
);
};
document.body.append(
el(threePS, { emoji: "🎉" }),
);