Apps need to remember settings between launches.
Direct answer
AsyncStorage saves small key-value data on the device, asynchronously. Use setItem, getItem and removeItem, and convert objects with JSON.stringify and JSON.parse. For secrets, use a secure storage library instead.
Install and use
npx expo install @react-native-async-storage/async-storage
import AsyncStorage from "@react-native-async-storage/async-storage";
await AsyncStorage.setItem("theme", "dark");
const theme = await AsyncStorage.getItem("theme");
await AsyncStorage.setItem("profile", JSON.stringify({ name: "Ada" }));
const profile = JSON.parse(await AsyncStorage.getItem("profile") || "null");
Load on start
useEffect(() => {
(async () => {
const saved = await AsyncStorage.getItem("theme");
if (saved) setTheme(saved);
})();
}, []);
When to use something else
| Need | Use |
|---|---|
| Secrets and tokens | secure storage |
| Larger or relational data | a local database |
| Data shared across devices | a backend |
Where Teyro fits
Teyro's React Native for Beginners course turns this into short lessons you can play in a few minutes a day. It has 80 lessons, and you can start free.
The bottom line
Great for preferences and simple state.



