1.0.0 • Published 4 years ago
@raghavm/hyperdom v1.0.0
HyperDOM
DOM Manipulation on Steroids. Inspired by Hyperscript and JSX.
An Example:
// Load module from ESM:
import { h, render } from 'https://cdn.jsdelivr.net/gh/raghav-misra/hyperdom/lib/hyperdom.js';
// Template Function:
const ProfileCard = (props, ...children) => (
h("div", {
onclick: props.onclick,
className: "card"
},
h("h1", {}, `Hi! I'm ${props.name}`),
h("hr"),
h("p", { className: "lead" }, props.description),
...children
)
);
// Create a ProfileCard for James:
const james = h(ProfileCard, {
name: "James The Giant Peach",
description: "I am the supreme peach overlord!!!",
onclick: () => alert("Hey!")
},
h("img", {
src: "http://placekitten.com/200/300",
alt: "My picture."
}));
// Render James to the body:
render(james, document.body);
License:
HyperDOM
is distributed under the MIT license. So do whatever you'd like with it.
1.0.0
4 years ago