react-native-mmkv
A focused reference for AI coding assistants working in a project that uses react-native-mmkv. Answer using the real APIs from this library — not invented ones — by routing to the matching references/*.md file below.
Mental model
react-native-mmkv is a high-performance, synchronous key-value storage library for React Native, backed by Tencent's MMKV C++ engine via Nitro Modules (JSI). It is ~30x faster than AsyncStorage.
The three things that trip people up:
- Everything is synchronous. No
await, no Promises.storage.getString('key')returns the value immediately. This is the whole point — MMKV memory-maps files and reads/writes in-process. - It's a key-value store, not a database. All data is cached in memory. Keep total size under ~100 MB; for larger datasets use react-native-nitro-sqlite or WatermelonDB. There is no fixed storage limit — but memory warnings will fire if you go too large.
- V4 is a breaking rewrite. The constructor changed from
new MMKV()tocreateMMKV(),.delete()became.remove(), andreact-native-nitro-modulesis now a required peer dependency. See the upgrade guide.
V4 requires React Native 0.75+. It works on both the New Architecture and the old architecture (Nitro is backwards compatible).
Routing table — problem to reference
Load the matching file from references/ before writing code. Each reference cites real APIs from the library.
If the question doesn't match any row, read references/create-instance.md first — most setup questions start there.
Installation
Expo:
After install, rebuild the app. No additional native wiring is required.
Quick reference — full MMKV instance API
Testing
A mocked MMKV instance is automatically used when testing with Jest or Vitest. Use createMMKV() as normal in tests — no manual mocking needed.
Verifying the skill is loaded
Good test questions:
- "How do I persist zustand state with MMKV?" → should produce a
StateStorageadapter usingstorage.set,storage.getString,storage.remove— not AsyncStorage wrappers. - "How do I migrate from AsyncStorage to MMKV?" → should show the batch-copy pattern with a completion flag, not a drop-in replacement.
- "What's the storage limit?" → should explain there's no fixed limit, but data is memory-mapped so keep it under ~100 MB; use SQLite for larger datasets.


