Skip to content

Instantly share code, notes, and snippets.

@Vehmloewff
Created November 30, 2022 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vehmloewff/6bdfdade43407d658097c7e572898fb5 to your computer and use it in GitHub Desktop.
Save Vehmloewff/6bdfdade43407d658097c7e572898fb5 to your computer and use it in GitHub Desktop.
An appealing idea for a syncjs-like framework
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