qat

Playground

Write a .qx component and see what the compiler makes of it. The compiler runs in your browser, in a worker, and loads on your first edit.

Compiled output

Edit the source to compile it in your browser
import { insert, on, signal, template } from '@qatjs/core'
import { deep } from '@qatjs/core/deep'
import { css as _css$ } from '@qatjs/core/style'
const _tpl$1 = /*#__PURE__*/ template('<button q-14nkyl><!> × 2 = <!></button>')
_css$("q-14nkyl", "button[q-14nkyl] { font: inherit; padding: 0.5em 1em; }")
// Edit me: the output and the diagnostics follow as you type.
export default function Counter(props) {
  const count = signal(deep((props.start !== undefined ? props.start : 0)))
  

  return (
    (() => {
      const _button$1 = _tpl$1();
      const _mark$1 = _button$1.firstChild;
      const _mark$2 = _mark$1.nextSibling.nextSibling;
      on(_button$1, 'click', () => count.set(count() + 1));
      insert(_button$1, count, _mark$1);
      insert(_button$1, () => (count() * 2), _mark$2);
      return _button$1;
    })()
  )
}
Counter.props = ["start"]




Diagnostics

No diagnostics