Socket
Book a DemoInstallSign in
Socket

react-level-count

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-level-count

Live updating leveldb count component for react

latest
Source
npmnpm
Version
1.2.6
Version published
Weekly downloads
16
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 18 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts