Write Marko components in TSRX.
Show before & after
| TSRX | Marko |
|---|---|
|
<h1>Groceries</h1>
<let/items=[]>
<ul>
<for|counter, i| of=items by="id">
<let/count=1>
<li>
<span>${counter.label}</span>
<button onClick() {
if (--count < 1) {
items = items.toSpliced(i, 1);
}
}>−</button>
<span>${count}</span>
<button onClick() { count++ }>+</button>
</li>
</for>
</ul>
<let/id=0>
<form onSubmit(e) {
e.preventDefault();
items = items.concat({ id: id++, label: e.target.item.value });
e.target.reset();
}>
<input name="item">
<button>Add</button>
</form> |
@marko/tsrx: compiles.tsrxto.markoTags API@marko/vite-plugin-tsrx: Vite plugin that serves compiled output as virtual.markofiles
examples/basic-spa— Vite SPAexamples/marko-run— full-stack with@marko/run
npm install
npm run build
npm test