Skip to content

Commit

Permalink
Back to CodePen for examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgebucaran committed Jan 21, 2021
1 parent ec6149c commit 4676877
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- **Write what, not how**—With a declarative API that's easy to read and fun to write, Hyperapp is the best way to build purely functional, feature-rich, browser-based apps in JavaScript.
- **Smaller than a favicon**—1 kB, give or take. Hyperapp is an ultra-lightweight Virtual DOM, highly-optimized diff algorithm, and state management library obsessed with minimalism.

Here's the first example to get you started—no bundlers or compilers. [Try it yourself](https://hyperapp.glitch.me/).
Here's the first example to get you started—look ma' no bundlers! [Try it in your browser](https://codepen.io/jorgebucaran/pen/zNxZLP?editors=1000).

<!-- prettier-ignore -->
```html
Expand All @@ -18,6 +18,7 @@ Here's the first example to get you started—no bundlers or compilers. [Try it
const AddTodo = (state) => ({
...state,
value: "",
todos: state.todos.concat(state.value),
})
Expand All @@ -30,11 +31,12 @@ Here's the first example to get you started—no bundlers or compilers. [Try it
init: { todos: [], value: "" },
view: ({ todos, value }) =>
h("main", {}, [
h("h1", {}, text("To do list")),
h("input", { type: "text", oninput: NewValue, value }),
h("button", { onclick: AddTodo }, text("Add")),
h("ul", {},
todos.map((todo) => h("li", {}, text(todo)))
),
h("button", { onclick: AddTodo }, text("New!")),
]),
node: document.getElementById("app"),
})
Expand Down

0 comments on commit 4676877

Please sign in to comment.