Skip to content

Instantly share code, notes, and snippets.

@jorgebucaran
Last active July 14, 2020 06:37
Show Gist options
  • Star 31 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorgebucaran/8dc33b7947f3193eb2ea3d5700e27036 to your computer and use it in GitHub Desktop.
Save jorgebucaran/8dc33b7947f3193eb2ea3d5700e27036 to your computer and use it in GitHub Desktop.
Getting started with Hyperapp
<!DOCTYPE html>
<html lang="en">
<head>
<script type="module">
import { h, text, app } from "https://unpkg.com/hyperapp"
app({
init: () => 0,
view: state =>
h("main", {}, [
h("h1", {}, text(state)),
h("button", { onclick: state => state - 1 }, text("-")),
h("button", { onclick: state => state + 1 }, text("+"))
]),
node: document.getElementById("app")
})
</script>
</head>
<body>
<main id="app"></main>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment