What is AsyncStorage in React Native?

Why Interviewers Ask This

This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex React Native topics. It also reveals how well you can explain technical ideas to non-experts.

Answer

AsyncStorage is a simple, asynchronous, unencrypted, persistent key-value storage system for React Native — the mobile equivalent of localStorage (but asynchronous). It's the simplest way to persist data between app sessions. The community package @react-native-async-storage/async-storage is the standard implementation (the original was removed from React Native core). Installation: npm install @react-native-async-storage/async-storage. API: import AsyncStorage from "@react-native-async-storage/async-storage"; // Store: await AsyncStorage.setItem("@user_token", token); // Retrieve: const token = await AsyncStorage.getItem("@user_token"); // null if not found // Remove: await AsyncStorage.removeItem("@user_token"); // Check all keys: const keys = await AsyncStorage.getAllKeys(); // Batch operations (efficient): await AsyncStorage.multiSet([["@key1", "val1"], ["@key2", "val2"]]); const values = await AsyncStorage.multiGet(["@key1", "@key2"]); // Clear ALL data: await AsyncStorage.clear();. Objects — must JSON encode: // Store object: await AsyncStorage.setItem("@user", JSON.stringify(user)); // Retrieve object: const stored = await AsyncStorage.getItem("@user"); const user = stored ? JSON.parse(stored) : null;. Limitations: strings only (JSON serialize objects), unencrypted (don't store sensitive data — use react-native-keychain or react-native-secure-storage), limited to 6MB (varies by platform), asynchronous. For sensitive data: use react-native-keychain (accesses iOS Keychain / Android Keystore). For complex structured data: consider WatermelonDB or SQLite.

Pro Tip

If you're unsure about a detail, say so honestly and explain your reasoning. Interviewers respect candidates who can think through uncertainty rather than bluffing.