What is local storage on mobile?
Local storage keeps data on the device between launches: user preferences, cached content, drafts, auth tokens. Options range from simple key-value stores (AsyncStorage, the much faster MMKV) to full on-device databases (SQLite, WatermelonDB) for structured data.
Why it matters
A mobile app that forgets everything on close feels broken. Local storage powers caching, offline support, and a fast startup that shows something before the network responds. Choosing the right tool — key-value versus database — for the data shape keeps the app fast and the code simple.
What to learn
- Key-value storage: AsyncStorage and MMKV
- Why MMKV is much faster than AsyncStorage
- On-device databases: SQLite, WatermelonDB
- Choosing storage by data shape and size
- Serializing and deserializing values
- Storage limits and performance
- What belongs in secure storage instead
Common pitfall
Storing large or structured datasets in AsyncStorage by stuffing big JSON strings into it. It is slow, asynchronous, and not built for that, so the app stutters. Use MMKV for fast key-value needs and a real on-device database for structured or sizable data — match the tool to the data.
Resources
Primary (free):
- Async Storage — Docs · docs
- MMKV — Docs · docs
- Expo — SQLite · docs
Practice
Persist a user preference with a key-value store (MMKV or AsyncStorage) so it survives an app restart. Then store a small set of structured records in SQLite and query them. Done when the preference persists across restarts and the structured data is queried from a database, not a giant JSON blob.
Outcomes
- Persist key-value data across launches.
- Choose MMKV over AsyncStorage for speed.
- Use an on-device database for structured data.
- Match the storage tool to the data shape.