H3 is a microframework to build client-side single-page applications (SPAs) in modern JavaScript.
H3 is also:
- tiny, under 700 sloc.
- modern, in the sense that it runs only in modern browsers (latest versions of Chrome, Firefox, Edge & similar).
- easy to learn, its API is comprised of only seven methods and two properties.
I’m sold! Where can I get it? ⇈
Here, look, it’s just one file:
Download v0.11.0 (Keen Klingon)
Yes there is also a NPM package if you want to use it with WebPack and similar, but let me repeat: it’s just one file.
Hello, World? ⇈
Here’s an example of an extremely minimal SPA created with H3:
import { h3, h } from "./h3.js";
h3.init(() => h("h1", "Hello, World!"));
This will render a h1
tag within the document body, containing the text "Hello, World!"
.
Something more complex? ⇈
Have a look at the code of a simple todo list (demo) with several components, a store and some routing.