lit-observable
lit-html + reactive
Install
$ yarn add @vuerd/lit-observable
or
$ npm install @vuerd/lit-observable
Usage
import { defineComponent, html, observable } from '@vuerd/lit-observable';
defineComponent('my-counter', {
render() {
const state = observable({ count: 0 });
const onIncrement = () => {
state.count++;
};
return () => html`
<button @click=${onIncrement}>Increment</button>
<span>${state.count}</span>
`;
},
});
const myCounter = document.createElement('my-counter');
document.body.appendChild(myCounter);