MMKV
react-native-mmkv is a fast key-value storage backed by MMKV.
Setup
- Install the package:
npm install react-native-mmkv
- Create one or more MMKV instances in your app (e.g. in a module or context):
import { createMMKV } from 'react-native-mmkv';
export const storage = createMMKV({ id: 'app-storage' });
// Optional: more instances
export const cache = createMMKV({ id: 'cache' });
- Pass them to
StorageInspector:
import { StorageInspector } from 'react-native-storage-inspector';
import { storage, cache } from './storage';
<StorageInspector mmkvInstances={[storage, cache]} />;
Behavior
- Required: Unlike Async Storage / Keychain / Secure Store, MMKV is not auto-discovered. You must pass
mmkvInstancesfor MMKV to appear. - Multiple instances: Each instance gets its own section (e.g. "MMKV", "MMKV 2" if you pass two).
- Types: MMKV can store strings, numbers, and booleans. The inspector reads/writes string values; the adapter uses
getStringandset(key, value).
Expo
MMKV uses native code. It works in development builds (e.g. with expo-dev-client), but not in Expo Go.