Skip to content
项目

关于

适用于 React Native 的异步、持久化键值存储系统。

网站与应用开发

这些数字如何统计

实测星标增长

24小时
0
7天
+2
15天
+3
1个月
0

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

React Native Async Storage

Async Storage is an asynchronous, unencrypted, persistent key-value storage solution for your React Native application. It provides a simple API compatible with the Web Storage API, with additional extensions for batch operations and multi-database support.

Supported platforms

  • Android (SQLite)
  • iOS (SQLite)
  • macOS (SQLite)
  • visionOS (legacy fallback, single database only)
  • Web (IndexedDB backend)
  • Windows (legacy fallback, single database only)

Compatibility

Compatibility table for React Native:

React Native Minimum Version
ios/android 0.76
macOS 0.78
visionOS 0.79
windows 0.79

Other components:

Component Version
kotlin 2.1.0
android min sdk 24
ios min target 13
macOS min target 12

Installation

# Using npm
npm install @react-native-async-storage/async-storage

# Using yarn
yarn add @react-native-async-storage/async-storage

iOS/macOS

Install cocoapods dependencies:

# inside macos/ios directory
pod install

Usage

import { createAsyncStorage } from "@react-native-async-storage/async-storage";

// create a storage instance
const storage = createAsyncStorage("appDB");

async function demo() {
  await storage.setItem("userToken", "abc123");

  const token = await storage.getItem("userToken");
  console.log("Stored token:", token); // abc123

  await storage.removeItem("userToken");
}

License

MIT

探索相关项目

加载中…