html
import { createSignal, customElement, html } from 'thunderous';
const MyElement = customElement(() => {
const [count, setCount] = createSignal(0);
// ...
return html`<output>${count}</output>`;
});
const MyElement = customElement(() => {
const [count, setCount] = createSignal(0);
// ...
return html`
<div>${count()}</div> <!-- template never updates -->
<div>${count}</div> <!-- template updates with the signal -->
`;
});
null
const MyElement = customElement(() => {
return html`
<div my-attr="${null}"></div> <!-- renders <div></div> -->
<div my-attr="${''}"></div> <!-- renders <div my-attr></div> -->
`;
});
getter()
const MyElement = customElement(({ getter }) => {
return html`
<p>${getter(() => 'Hello, world!')}</p> <!-- renders <p>Hello, world!</p> -->
`;
});
css CSSStyleSheet CSSStyleSheet