@react-native-async-storage/async-storage: key-value persistent, async API, dữ liệu lưu file (iOS) hoặc SQLite (Android). Cross-platform, ổn định, hệ sinh thái lớn. Nhược: async (Promise mỗi call) → block render khi data nhiều, plain text không mã hóa, limit ~6MB Android.
react-native-mmkv: key-value siêu nhanh, đồng bộ API, dùng MMKV của Tencent (mmap-based). 30x nhanh hơn AsyncStorage. Hỗ trợ encryption AES (option). API:
const storage = new MMKV()
storage.set('token', 'abc') // sync, không await
const token = storage.getString('token')Ưu: Sync (đọc trong render, không Promise), encryption built-in, performance đỉnh.
Expo SecureStore / react-native-keychain: dùng Keychain (iOS) / Keystore (Android) để lưu sensitive data (token, password). Mã hóa hardware-backed. Slow hơn nhiều so với MMKV vì hardware roundtrip.
Quy tắc:
- Sensitive (auth token, refresh token): SecureStore/Keychain.
- App preferences, cache nhỏ, sync cần thiết: MMKV.
- Compatibility với lib cũ, dữ liệu không sensitive: AsyncStorage.