๐ฅ Simple
๐ฅ Small (~15kb)
๐ฅ Independent
git clone https://github.com/pauwell/elch.git
npm install
npm run build
const myTemplate = new Elch({
name: 'counter-example',
state: { count: 0 },
logic: {
incrementCount() {
this.count += 1;
}
},
view: () =>
`<div class="counter-app">
<h1>Counter</h1>
<p>Current value: {{count}}</p>
<button do-event="click:incrementCount">Click</button>
</div>`
});
myTemplate.mountTo(document.getElementById('app'));
<do if="this.state.count > 10">
<p>Visible if count is greater than ten.</p>
</do>
<do for="let i=0; i<this.state.count; ++i">
<p>{{ $i }}</p>
</do>
<button do-event="click:incrementCount">Click</button>
<div class="other-template">
<counter-app></counter-app>
</div>