4.4.0 • Published 3 years ago

j-light-store v4.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

j-light-store

Ultralight store

Usage

Example with lit-html to render.

import { Store } from "j-light-store";
import { render, html } from "lit-html";

function reducer(_, state) {
  return state + 1;
};

const store = new Store();

function counter() {
    const [value, dispatch] = store.useReducer("counter", reducer, 0);
    return html`
        <h2>${value}</h2>
        <button @click=${() => dispatch({})}>+1</button>
    `;
};

function app() {
    return html`
        <h1>COUNTER!</h1>
        <div>${counter()}</div>
    `;
}

store.subscribe(() => render(app(), document.body));
store.refresh();

License

MIT, see LICENSE

4.4.0

3 years ago

4.0.4

3 years ago

4.1.0

3 years ago

4.0.1

3 years ago

4.3.0

3 years ago

4.1.2

3 years ago

4.0.3

3 years ago

4.2.0

3 years ago

4.1.1

3 years ago

4.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.0

4 years ago