1.0.0 • Published 7 years ago

react-native-asyncstorage v1.0.0

Weekly downloads
24
License
MIT
Repository
github
Last release
7 years ago

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