Last active
July 19, 2022 07:52
-
-
Save kt3k/77d7c6491fd6cc75ab887cdaa48836a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @jsx h */ | |
import { bind, h } from "https://deno.land/x/[email protected]/paul.ts"; | |
bind("my-component", ({ on, morph }) => { | |
let count = 0; | |
on("click", "button", () => { | |
count++; | |
render(); | |
}); | |
const render = () => morph(<Component count={count} />); | |
render(); | |
}); | |
export default function Component({ count }: { count: number }) { | |
return ( | |
<div class="my-component"> | |
<div>{count}</div> | |
<button> | |
Click me! | |
</button> | |
</div> | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @jsx h */ | |
import { bind, h } from "https://deno.land/x/[email protected]/paul.ts"; | |
bind("my-component", ({ on, morph }) => { | |
let count = 0; | |
on("click", "button", () => { | |
count++; | |
render(); | |
}); | |
const render = () => | |
morph( | |
<div class="my-component"> | |
<div>{count}</div> | |
<button> | |
Click me! | |
</button> | |
</div>, | |
); | |
render(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment