react-localforage
v1.0.1
Published
Declarative localForage in React
Downloads
206
Maintainers
Readme
react-localforage
Declarative localForage in React
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>
)
}}
/>