Declarative localForage in React
npm install -S react-localforage
import Forage from 'react-localforage'
<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
itemKey='auth-token'
itemValue={authToken}
render={({inProgress, value, error}) => {
return (
<div>
{error &&
<div>
{error.message}
</div>}
{inProgress && <progress/>}
{value &&
<div>
{value}
</div>}
</div>
)
}}
/>