react-native-asyncstorage

1.0.0 • Public • Published

react-native-asyncstorage

Declarative AsyncStorage component for React Native

Installation

yarn add react-native-asyncstorage

or

npm install --save react-native-asyncstorage

API

  • AsyncStorage.GetItem
  • AsyncStorage.SaveItem

Usage Examples

Fetch apiToken from AsyncStorage before loading the rest of the app

<AsyncStorage.GetItem
  itemKey='apiToken'
  render={({ loading, value, error }) => {
 
    if (loading) return <AppLoading />
 
    return (
      <Provider store={store}>
        <AppWithNavigationState />
      </Provider>
    )
 
  }}
/>
 

Shoutout

Thanks to @tkh44 for the idea and his localforage version. He makes a lot of great shit, follow him on Twitter

Package Sidebar

Install

npm i react-native-asyncstorage

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • peterpme