1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-01-18 15:33:14 +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 { el } from "deka-dom-el";
import { S } from "deka-dom-el/signals"; import { S } from "deka-dom-el/signals";
const threePS= ({ emoji= "🚀" })=> {
const clicks= S(0); // A const clicks= S(0); // A
document.body.append( return el().append(
el().append(
el("p", S(()=> el("p", S(()=>
"Hello World "+"🎉".repeat(clicks()) // B "Hello World "+emoji.repeat(clicks()) // B
)), )),
el("button", { el("button", {
type: "button", type: "button",
onclick: ()=> clicks(clicks()+1), // C onclick: ()=> clicks(clicks()+1), // C
textContent: "Fire", textContent: "Fire",
}) })
)
); );
};
document.body.append(
el(threePS, { emoji: "🎉" }),
);