all repos — h3 @ bf85a2101d1d9ed083a15ad2113836eea5490cfe

A tiny, extremely minimalist JavaScript microframework.

docs/example/assets/js/components/TodoList.js

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

export default function TodoList() {
  const { page, pagesize } = h3.state;
  const filteredTodos = h3.state.filteredTodos;
  const start = (page - 1) * pagesize;
  const end = Math.min(start + pagesize, filteredTodos.length);
  return h3(
    "div.todo-list",
    filteredTodos.slice(start, end).map(Todo)
  );
}