react-localforage

1.0.1 • Public • Published

react-localforage

Declarative localForage in React

npm version Build Status codecov

Install

npm install -S react-localforage
import Forage from 'react-localforage'

API

Forage.GetItem

<Forage.GetItem
  key='auth-token'
  render={({inProgress, value, error}) => {
    return (
      <div>
        {error &&
        <div>
          {error.message}
        </div>}
        {inProgress && <progress/>}
        {value &&
         <pre>{JSON.stringify(value, null, 2)}</pre>}
      </div>
    )
  }}
/>

Forage.SetItem

<Forage.SetItem
  itemKey='auth-token'
  itemValue={authToken}
  render={({inProgress, value, error}) => {
    return (
      <div>
        {error &&
        <div>
          {error.message}
        </div>}
        {inProgress && <progress/>}
        {value &&
        <div>
          {value}
        </div>}
      </div>
    )
  }}
/>

Package Sidebar

Install

npm i react-localforage

Weekly Downloads

16

Version

1.0.1

License

MIT

Last publish

Collaborators

  • tkh44