Skip to content

Instantly share code, notes, and snippets.

@kt3k
Last active July 19, 2022 07:52
Show Gist options
  • Save kt3k/77d7c6491fd6cc75ab887cdaa48836a8 to your computer and use it in GitHub Desktop.
Save kt3k/77d7c6491fd6cc75ab887cdaa48836a8 to your computer and use it in GitHub Desktop.
/** @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>
);
}
/** @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