async-storage

An asynchronous, persistent, key-value storage system for React Native.

  • Owner: react-native-async-storage/async-storage
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

React Native Async Storage

An asynchronous, unencrypted, persistent, key-value storage system for React Native.

AsyncStorage v2 is out!

Release Candidate for AsyncStorage v2 is out. More info can be found here..

Getting Started

Install

$ yarn add @react-native-community/async-storage
  • React Native 0.60+

CLI autolink feature links the module while building the app.

  • React Native <= 0.59
$ react-native link @react-native-community/async-storage

Note For iOS using cocoapods, run:

$ cd ios/ && pod install

See docs for manual linking guide

Upgrading to React Native 0.60+

New React Native comes with autolinking feature, which automatically links Native Modules in your project.
In order to get it to work, make sure you unlink Async Storage first:

$ react-native unlink @react-native-community/async-storage

Usage

Import

import AsyncStorage from '@react-native-community/async-storage';

Store data


storeData = async () => {
  try {
    await AsyncStorage.setItem('@storage_Key', 'stored value')
  } catch (e) {
    // saving error
  }
}

Read data


getData = async () => {
  try {
    const value = await AsyncStorage.getItem('@storage_Key')
    if(value !== null) {
      // value previously stored
    }
  } catch(e) {
    // error reading value
  }
}

Advanced

See docs for api and more examples or advanced usages.

Writing tests

Using Jest for testing? Make sure to check out docs on how to integrate it with this module.

Contribution

See the CONTRIBUTING file for how to help out.

License

MIT

Main metrics

Overview
Name With Ownerreact-native-async-storage/async-storage
Primary LanguageTypeScript
Program languageJava (Language Count: 12)
Platform
License:MIT License
所有者活动
Created At2019-02-06 15:51:20
Pushed At2025-06-12 07:58:08
Last Commit At
Release Count117
Last Release Name@react-native-async-storage/async-storage@2.2.0 (Posted on 2025-06-05 12:15:49)
First Release Namev1.0.0 (Posted on 2019-02-11 17:35:53)
用户参与
Stargazers Count4.9k
Watchers Count34
Fork Count477
Commits Count550
Has Issues Enabled
Issues Count675
Issue Open Count18
Pull Requests Count393
Pull Requests Open Count1
Pull Requests Close Count69
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private