react-native-mmkv is a high-performance, persistent key-value storage solution for React Native applications. It leverages Tencent's MMKV library, which is written in C++ and optimized for speed, providing significantly faster read/write operations compared to AsyncStorage. The current stable version is 4.3.1. The library maintains a rapid release cadence, with multiple minor and patch releases occurring monthly, indicating active development and responsiveness to bug fixes and feature enhancements. Key differentiators include its raw speed, native implementation via Nitro, and seamless integration with both old and new React Native architectures, supporting various data types efficiently. Version 4.x introduced a complete rewrite using Nitro and now integrates `MMKVCore` through native dependency managers like CocoaPods and Gradle, simplifying its native setup.
npm install react-native-mmkvVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize an MMKV storage instance, store various data types (string, number, boolean, JSON objects), retrieve them, and delete specific keys. It also includes an example of setting up an encrypted storage instance.
Refer to the official V4 upgrade guide on the GitHub repository for detailed migration steps and potential breaking changes. Ensure your `react-native-nitro-modules` version is compatible.
Upgrade your `react-native-nitro-modules` package to version `0.35.0` or newer: `npm install react-native-nitro-modules@^0.35.0` or `yarn add react-native-nitro-modules@^0.35.0`.
If you are upgrading from an earlier beta or custom setup, remove `pod 'MMKVCore', :defines_modules => true` from your `ios/Podfile`.
Upgrade to version 4.3.1 or higher to ensure `set(ArrayBuffer)` functions correctly across all supported platforms, including Web.
Upgrade to `react-native-mmkv` version 4.1.2 or higher to resolve issues related to duplicate Nitro Modules libraries.
Upgrade `react-native-mmkv` to version 4.3.1 or higher, which includes a fix to replace `TurboReactPackage` with `BaseReactPackage` for broader compatibility.
Ensure you have run `npx pod-install` (iOS) or `cd android && ./gradlew clean` then `cd ..` and rebuild your app. For v4, also verify that `react-native-nitro-modules` is correctly installed and linked.
Ensure that each `MMKV` instance you create has a unique `id`. If you intend to use the same storage, reuse the existing instance instead of creating a new one with the same `id`.
Install/update `react-native-nitro-modules` (`npm install react-native-nitro-modules@latest`) and ensure your `android/build.gradle` and `app/build.gradle` configurations are up-to-date according to the `react-native-mmkv` and `nitro` documentation.