Created
November 30, 2022 03:30
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