Skip to content
πŸ‘¨β€πŸŒΎ Declarative localForage in React
Branch: master
Clone or download
Kye Hohenberger
Latest commit 75bf231 Aug 27, 2017

README.md

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
  itemKey='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>
    )
  }}
/>
You can’t perform that action at this time.