Home

Awesome

preact-level-list

Live updating leveldb list component for preact!

Example

import { h, render, Component } from 'preact'
import level from 'level'
import { List } from 'preact-level-list'

const db = level('/tmp/preact-level-list')

class Example extends Component {
  render () {
    return (
      <ul id="example">
        <List
          db={db}
          prefix='prefix'
          renderRow={ ({ value }) => <li>{value}</li> }
        />
      </div>
    )
  }
}

Now the <List /> component will always reflect the values you have stored in your database with prefix.

Find a full example in /example:

$ npm install
$ npm run rebuild
$ npm start

screenshot

Installation

$ npm install preact-level-list

API

<List db prefix renderRow />

License

MIT