all repos — h3 @ 68daa6a4f7e8660bb651e52e6d2a171984f568ad

A tiny, extremely minimalist JavaScript microframework.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
import { h3, h } 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 h("div.todo-list", filteredTodos.slice(start, end).map(Todo));
}