React Native · Mobile UI at native speed
What is AsyncStorage and when should you use it?
Short answer
AsyncStorage is an asynchronous, unencrypted key-value store backed by platform storage. Use it for small non-sensitive preferences, not for secrets or large structured data.
AsyncStorage stores strings under string keys. Values must be serialised, usually with JSON. Reads and writes return promises, and the API is global to the app rather than scoped to a screen.
import AsyncStorage from "@react-native-async-storage/async-storage";
const KEY = "settings.v1";
export async function saveSettings(value: { theme: "light" | "dark" }) {
await AsyncStorage.setItem(KEY, JSON.stringify(value));
}
export async function loadSettings(): Promise<{ theme: "light" | "dark" } | null> {
const raw = await AsyncStorage.getItem(KEY);
return raw ? JSON.parse(raw) : null;
}Good and bad fits
- Good: theme choice, onboarding flag, last selected tab, a small cached profile
- Bad: passwords, tokens, health data or anything requiring encryption
- Bad: large lists or binary blobs, which are slow and memory-heavy
- Better for secrets: Keychain on iOS and Keystore-backed storage on Android
- Better for large structured data: SQLite, MMKV or a file-backed database
AsyncStorage is not transactional. If you write a related pair of keys and the app is killed between writes, you can end up with inconsistent state. Store related values under one key or use a database with transactions.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1Is AsyncStorage encrypted?
- 2What would you use to store an auth token?
- 3How do you migrate stored data between app versions?
- 4When would you choose SQLite or MMKV over AsyncStorage?
Say it in the interview
AsyncStorage is an asynchronous key-value store for small, non-sensitive data such as preferences and onboarding flags. I version keys and parse defensively so corrupted data does not crash startup. I never store tokens there, because it is not encrypted; those belong in Keychain or Keystore-backed secure storage, and large structured data belongs in a database.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live React Native mock interview and get scored feedback on depth, clarity and confidence.