Closed WebReflection closed 4 years ago
const {define, render, html, useState} = heresy; define('Welcome', { hooks: true, // enable hooks within the render method extends: 'element', style: comp => ` ${comp} { font-size: 16px; font-family: sans-serif; font-weight: bold; } ${comp} > u { font-weight: normal; }` , render() { const [clicks, setState] = useState(0); this.html`Hello <u>${navigator.userAgent}</u> <hr/> <button onclick=${() => setState(clicks + 1)}>clicks ${clicks}</button>`; } }); render(document.body, html`<Welcome/>`);