Skip to content

Module 02 · Lesson 05

Saving data on the device

AsyncStorage for simple data, a backend when you need sharing.

Build screens6 min
npx expo install @react-native-async-storage/async-storage
Use `npx expo install`, not `npm install`, so the version matches your Expo SDK.
import AsyncStorage from "@react-native-async-storage/async-storage";

await AsyncStorage.setItem("cart", JSON.stringify(items));
const saved = JSON.parse((await AsyncStorage.getItem("cart")) ?? "[]");