1.2.6 • Published 6 years ago

react-level-count v1.2.6

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

react-level-count

Live updating leveldb + react component for counting the k/v pairs under a prefix!

Example

import React from 'react'
import level from 'level'
import { Count } from 'react-level-count'

const db = level('/tmp/react-level-count')

class Example extends React.Component {
  render () {
    return (
      <div>
        Live count: <Count db={db} prefix="prefix" />
      </div>
    )
  }
}

Now the <Count /> component will always reflect the number of k/v pairs you have stored in your database with the prefix prefix.

Find a full example in /example:

$ npm install
$ npm run rebuild
$ npm start

screenshot

Installation

$ npm install react-level-value

API

<Count db [prefix filter render] />

Use filter to pick what adds to the count, like so:

<Count
  db={db}
  filter={({ key, value }) => true}
/>

Use render for a custom render function:

<Count
  db={db}
  render={count => <strong>{count}</strong>}
/>

License

MIT

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago