Created
November 30, 2022 03:30
-
-
Save Vehmloewff/6bdfdade43407d658097c7e572898fb5 to your computer and use it in GitHub Desktop.
An appealing idea for a syncjs-like framework
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
export function HomePage() { | |
const { setTemplate, update } = createPage() | |
const title = 'Example' | |
const heading = 'Simple Counter' | |
let clicked = 0 | |
function increment() { | |
clicked++ | |
update('#message') | |
} | |
setTemplate(() => ( | |
<html> | |
<head> | |
<title>{title}</title> | |
</head> | |
<body> | |
<h1>{heading}</h1> | |
<p id="message">Clicked {clicked} time(s)</p> | |
<button s-click="increment">Increment</button> | |
</body> | |
</html> | |
)) | |
return { increment } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment