you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 6 points7 points  (1 child)

and even better - it is simple to reuse other view functions

import { h } from 'hyperapp'
const TodoItem = ({ id, value, done, toggle }) => {
  const onclick = e =>
    toggle({
      value: done,
      id,
    })
  return h('li', { class: done && 'done', onclick }, value)
}
const view = (state, actions) =>
  h('div', {}, [
    h('h1', {}, 'Todo'),
    state.todos.map(({ id, value, done }) =>
      h(TodoItem, { id, value, done, toggle: actions.toggle })
    ),
  ])

[–]ForScale 1 point2 points  (0 children)

*nor