Internals: The compiler

Internals

The compiler

Test page.

let count = $state(0);

export const App = () => <button onClick={() => count++}>{count}</button>;
import { createSignal, createEffect } from "@sigil-dev/runtime";
const count = createSignal(0);
export const App = () => (() => {
  const _el0 = document.createElement("button");
  _el0.addEventListener("click", () => count.set(count() + 1));
  const _el1 = document.createTextNode("");
  createEffect(() => {
    _el1.textContent = String(count());
  });
  _el0.append(_el1);
  return _el0;
})();
let count = 0;
export const App = () => __h(`<button><!--g-->${__e(count)}<!--/g--></button>`);
ab
xy

Heading $state one

Sub

Edit this page