all repos — h3 @ 4eaeb4a491990f91fb316c0349ad12066b7666d8

A tiny, extremely minimalist JavaScript microframework.

example/assets/js/components/todo.js

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
import h3 from "../h3.js";

export default function Todo(data, actions) {
  const { toggleTodo, removeTodo } = actions;
  const todoStateClass = data.done ? ".done" : ".todo";
  return h3("div.todo-item", { id: data.key }, [
    h3(`div.todo-content${todoStateClass}`, [
      h3("span.todo-text", { onclick: () => toggleTodo(data) }, data.text),
    ]),
    h3("span.delete-todo", { onclick: () => removeTodo(data) }, "✘"),
  ]);
};