signalizejs/hyperscript
Hyperscript: create HTML elements easily with reactive data and attributes.
Installation
Required import map dependencies:
const { h } = await signalize.resolve('hyperscript');
API
h
// Only a tag
const template = h('div');
// Tag and a string
const template = h('div', 'Content');
// Tag, attributes, content
const template = h('div', { class: 'example' }, 'Hello', 'World', '!');
const template = h('div', { class: 'example' },
h('p', 'Hello World!'),
h('p', 'Another Paragraph!')
);
// Replacing existing element
document.querySelector('#app').replaceWith(template);
An example with signals:
__CODE__