This package has been deprecated

Author message:

WARNING: This project has been renamed to unistore-lit. Install using unistore-lit instead.

unistore-hyper

0.2.0 • Public • Published

unistore-hyper

A unistore connector to hyperhtml and lit-html.

Examples

Usage

store.js

import connectTo from 'unistore-hyper';
 
export const store = createStore({
  list: [
    { id: 1, text: 'Do the thing!' },
    { id: 2, text: 'Do another thing!' },
  ],
});
 
export const connect = connectTo(store);

app.js

import { connect } from './store';
 
const mapStateToProps = state => ({
  myList: state.list,
});
 
export const App = connect(mapStateToProps)(
  ({ myList }) => html`
    <ul>
      ${myList.map(
        item => html`<li>${item.id} - ${item.text}</li>`
      )}
    </ul>
  `
);

index.js

import { render } from 'lighterhtml'; // or 'lit-html'
import { store } from './store';
import { App } from './app';
 
const renderApp = () => render(document.body, App);
 
renderApp() && store.subscribe(renderApp);

Package Sidebar

Install

npm i unistore-hyper

Weekly Downloads

204

Version

0.2.0

License

MIT

Unpacked Size

10.2 kB

Total Files

8

Last publish

Collaborators

  • djalmajr