all repos — h3 @ af1f1a5943e809b4a5ebd7a4ef13c8dc612ed5dc

A tiny, extremely minimalist JavaScript microframework.

example/assets/js/components/addTodoForm.js

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
import h3 from "../h3.js";

export default function AddTodoForm(actions) {
  const { addTodo, addTodoOnEnter } = actions;
  return h3("form.add-todo-form", [
    h3("input", {
      id: "new-todo",
      placeholder: "What do you want to do?",
      autofocus: true,
      onkeydown: addTodoOnEnter,
    }),
    h3(
      "span.submit-todo",
      {
        onclick: addTodo,
      },
      ["+"]
    ),
  ]);
}