Skip to content

Latest commit

 

History

History
 
 

lit-observable

lit-observable

lit-html + reactive

npm version GitHub PRs CI

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);