/hyperlist-component

Wraps HyperList with Nanocomponent to allow use as a pureish component.

Primary LanguageJavaScript

HyperList Component

Wraps HyperList with Nanocomponent to allow use as a pureish component.

Usage

const html = require('bel')
const HyperList = require('hyperlist-component')

const opts = {
  height: 500,
  itemHeight: 30,
  eachItem: (state, index) => html`<li>${state.items[index]}</li>`,
  getTotal: (state) => state.items.length
}
const hyperList = new HyperList('ul', opts)

const ul = hyperList.render({ items: [1, 2, 3] }) // can be called repeatedly