[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-10418":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":23,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":41,"readmeContent":42,"aiSummary":43,"trendingCount":16,"starSnapshotCount":16,"syncStatus":44,"lastSyncTime":45,"discoverSource":46},10418,"react-native-mmkv","mrousavy\u002Freact-native-mmkv","mrousavy","⚡️ The fastest key\u002Fvalue storage for React Native. ~30x faster than AsyncStorage!","https:\u002F\u002Fmrousavy.com",null,"TypeScript",8385,339,32,3,0,1,13,65,9,38.59,"MIT License",false,"main",[26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"android","cpp","database","fast","ios","jni","jsi","localstorage","mmkv","native-module","nitro","react","react-native","storage","turbomodule","2026-06-12 02:02:21","| **V4 Docs** | [old V3 Docs](.\u002FREADME_V3.md) |\n|:---|:---|\n\n\u003Ca href=\"https:\u002F\u002Fmargelo.com\">\n  \u003Cpicture>\n    \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\".\u002Fdocs\u002Fimg\u002Fbanner-dark.webp\" \u002F>\n    \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\".\u002Fdocs\u002Fimg\u002Fbanner-light.webp\" \u002F>\n    \u003Cimg alt=\"react-native-mmkv\" src=\".\u002Fdocs\u002Fimg\u002Fbanner-light.webp\" \u002F>\n  \u003C\u002Fpicture>\n\u003C\u002Fa>\n\n\u003Cdiv align=\"center\">\n  \u003Ch1 align=\"center\">MMKV\u003C\u002Fh1>\n  \u003Ch3 align=\"center\">The fastest key\u002Fvalue storage for React Native.\u003C\u002Fh3>\n\u003C\u002Fdiv>\n\n\u003Cdiv align=\"center\">\n  \u003Ca align=\"center\" href=\"https:\u002F\u002Fgithub.com\u002Fmrousavy?tab=followers\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Ffollowers\u002Fmrousavy?label=Follow%20%40mrousavy&style=social\" \u002F>\n  \u003C\u002Fa>\n  \u003Cbr\u002F>\n  \u003Ca align=\"center\" href=\"https:\u002F\u002Ftwitter.com\u002Fmrousavy\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Ftwitter\u002Ffollow\u002Fmrousavy?label=Follow%20%40mrousavy&style=social\" \u002F>\n  \u003C\u002Fa>\n  \u003Cbr \u002F>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fmrousavy\">\n    \u003Cimg align=\"right\" width=\"160\" alt=\"This library helped you? Consider sponsoring!\" src=\".github\u002Ffunding-octocat.svg\">\n  \u003C\u002Fa>\n\u003C\u002Fdiv>\n\u003Cbr\u002F>\n\n\n* **MMKV** is an efficient, small mobile key-value storage framework developed by WeChat. See [Tencent\u002FMMKV](https:\u002F\u002Fgithub.com\u002FTencent\u002FMMKV) for more information\n* **react-native-mmkv** is a library that allows you to easily use **MMKV** inside your React Native app through fast and direct JS bindings to the native C++ library.\n\n## Features\n\n* **Get** and **set** strings, booleans, numbers and ArrayBuffers\n* **Fully synchronous** calls, no async\u002Fawait, no Promises, no Bridge.\n* **Encryption** support (secure storage)\n* **Multiple instances** support (separate user-data with global data)\n* **Customizable storage location**\n* **High performance** because everything is **written in C++**\n* **~30x faster than AsyncStorage**\n* Uses [**JSI**](https:\u002F\u002Freactnative.dev\u002Fdocs\u002Fthe-new-architecture\u002Flanding-page#fast-javascriptnative-interfacing) and [**C++ NitroModules**](https:\u002F\u002Fgithub.com\u002Fmrousavy\u002Fnitro) instead of the \"old\" Bridge\n* **iOS**, **Android** and **Web** support\n* Easy to use **React Hooks** API\n\n> [!IMPORTANT]\n> - **You're looking at MMKV V4. If you're still on V3, check out the [V3 docs here](.\u002FREADME_V3.md)**!\n> - react-native-mmkv **V4** is now a [Nitro Module](https:\u002F\u002Fnitro.margelo.com). See the [V4 Upgrade Guide](.\u002Fdocs\u002FV4_UPGRADE_GUIDE.md) for more information.\n\n## Benchmark\n\n[StorageBenchmark](https:\u002F\u002Fgithub.com\u002Fmrousavy\u002FStorageBenchmark) compares popular storage libraries against each other by reading a value from storage for 1000 times:\n\n\u003Cdiv align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmrousavy\u002FStorageBenchmark\">\n    \u003Cimg src=\".\u002Fdocs\u002Fimg\u002Fbenchmark_1000_get.png\" \u002F>\n  \u003C\u002Fa>\n  \u003Cp>\n    \u003Cb>MMKV vs other storage libraries\u003C\u002Fb>: Reading a value from Storage 1000 times. \u003Cbr\u002F>\n    Measured in milliseconds on an iPhone 11 Pro, lower is better. \u003Cbr\u002F>\n  \u003C\u002Fp>\n\u003C\u002Fdiv>\n\n## Installation\n\n### React Native\n\n```sh\nnpm install react-native-mmkv react-native-nitro-modules\ncd ios && pod install\n```\n\n### Expo\n\n```sh\nnpx expo install react-native-mmkv react-native-nitro-modules\nnpx expo prebuild\n```\n\n## Usage\n\n### Create a new instance\n\nTo create a new instance of the MMKV storage, use the `MMKV` constructor. It is recommended that you re-use this instance throughout your entire app instead of creating a new instance each time, so `export` the `storage` object.\n\n#### Default\n\n```ts\nimport { createMMKV } from 'react-native-mmkv'\n\nexport const storage = createMMKV()\n```\n\nThis creates a new storage instance using the default MMKV storage ID (`mmkv.default`).\n\n#### App Groups or Extensions\n\nIf you want to share MMKV data between your app and other apps or app extensions in the same group, open `Info.plist` and create an `AppGroupIdentifier` key with your app group's value. MMKV will then automatically store data inside the app group which can be read and written to from other apps or app extensions in the same group by making use of MMKV's multi processing mode.\nSee [Configuring App Groups](https:\u002F\u002Fdeveloper.apple.com\u002Fdocumentation\u002Fxcode\u002Fconfiguring-app-groups).\n\n#### Customize\n\n```ts\nimport { createMMKV } from 'react-native-mmkv'\n\nexport const storage = createMMKV({\n  id: `user-${userId}-storage`,\n  path: `${USER_DIRECTORY}\u002Fstorage`,\n  encryptionKey: 'hunter2',\n  encryptionType: 'AES-256',\n  mode: 'multi-process',\n  readOnly: false,\n  compareBeforeSet: false,\n})\n```\n\nThis creates a new storage instance using a custom MMKV storage ID. By using a custom storage ID, your storage is separated from the default MMKV storage of your app.\n\nThe following values can be configured:\n\n* `id`: The MMKV instance's ID. If you want to use multiple instances, use different IDs. For example, you can separate the global app's storage and a logged-in user's storage. (required if `path` or `encryptionKey` fields are specified, otherwise defaults to: `'mmkv.default'`)\n* `path`: The MMKV instance's root path. By default, MMKV stores file inside `$(Documents)\u002Fmmkv\u002F`. You can customize MMKV's root directory on MMKV initialization (documentation: [iOS](https:\u002F\u002Fgithub.com\u002FTencent\u002FMMKV\u002Fwiki\u002FiOS_advance#customize-location) \u002F [Android](https:\u002F\u002Fgithub.com\u002FTencent\u002FMMKV\u002Fwiki\u002Fandroid_advance#customize-location))\n* `encryptionKey`: The MMKV instance's encryption\u002Fdecryption key. By default, MMKV stores all key-values in plain text on file, relying on iOS's\u002FAndroid's sandbox to make sure the file is encrypted. Should you worry about information leaking, you can choose to encrypt MMKV. (documentation: [iOS](https:\u002F\u002Fgithub.com\u002FTencent\u002FMMKV\u002Fwiki\u002FiOS_advance#encryption) \u002F [Android](https:\u002F\u002Fgithub.com\u002FTencent\u002FMMKV\u002Fwiki\u002Fandroid_advance#encryption))\n* `encryptionType`: The MMKV instance's encryption\u002Fdecryption algorithm. By default, AES-128 encryption will be used, but you can switch to AES-256 for advanced security.\n* `mode`: The MMKV's process behaviour - when set to `multi-process`, the MMKV instance will assume data can be changed from the outside (e.g. App Clips, Extensions or App Groups).\n* `readOnly`: Whether this MMKV instance should be in read-only mode. This is typically more efficient and avoids unwanted writes to the data if not needed. Any call to `set(..)` will throw.\n* `compareBeforeSet`: Whether this MMKV instance will compare values for equality before writing them to disk. By default this is disabled, enabling it might improve performance if values are repeatedly written to disk, even if they are already persisted.\n\n### Set\n\n```ts\nstorage.set('user.name', 'Marc')\nstorage.set('user.age', 21)\nstorage.set('is-mmkv-fast-asf', true)\n```\n\n### Get\n\n```ts\nconst username = storage.getString('user.name') \u002F\u002F 'Marc'\nconst age = storage.getNumber('user.age') \u002F\u002F 21\nconst isMmkvFastAsf = storage.getBoolean('is-mmkv-fast-asf') \u002F\u002F true\n```\n\n### Hooks\n\n```ts\nconst [username, setUsername] = useMMKVString('user.name')\nconst [age, setAge] = useMMKVNumber('user.age')\nconst [isMmkvFastAsf, setIsMmkvFastAsf] = useMMKVBoolean('is-mmkv-fast-asf')\n```\n\n### Keys\n\n```ts\n\u002F\u002F checking if a specific key exists\nconst hasUsername = storage.contains('user.name')\n\n\u002F\u002F getting all keys\nconst keys = storage.getAllKeys() \u002F\u002F ['user.name', 'user.age', 'is-mmkv-fast-asf']\n\n\u002F\u002F delete a specific key + value\nconst wasRemoved = storage.remove('user.name')\n\n\u002F\u002F delete all keys\nstorage.clearAll()\n```\n\n### Objects\n\n```ts\nconst user = {\n  username: 'Marc',\n  age: 21\n}\n\n\u002F\u002F Serialize the object into a JSON string\nstorage.set('user', JSON.stringify(user))\n\n\u002F\u002F Deserialize the JSON string into an object\nconst jsonUser = storage.getString('user') \u002F\u002F { 'username': 'Marc', 'age': 21 }\nconst userObject = JSON.parse(jsonUser)\n```\n\n### Encryption\n\n```ts\n\u002F\u002F encrypt all data with a private key using AES-128\nstorage.encrypt('hunter2')\n\u002F\u002F encrypt all data with a private key using AES-256\nstorage.encrypt('hunter2again', 'AES-256')\n\n\u002F\u002F remove encryption\nstorage.decrypt()\n```\n\n### Buffers\n\n```ts\nconst buffer = new ArrayBuffer(3)\nconst dataWriter = new Uint8Array(buffer)\ndataWriter[0] = 1\ndataWriter[1] = 100\ndataWriter[2] = 255\nstorage.set('someToken', buffer)\n\nconst buffer = storage.getBuffer('someToken')\nconsole.log(buffer) \u002F\u002F [1, 100, 255]\n```\n\n### Size\n\n```ts\n\u002F\u002F get size of MMKV storage in bytes\nconst size = storage.size\nif (size >= 4096) {\n  \u002F\u002F clean unused keys and clear memory cache\n  storage.trim()\n}\n```\n\n### Importing all data from another MMKV instance\n\nTo import all keys and values from another MMKV instance, use `importAllFrom(...)`:\n\n```ts\nconst storage = createMMKV(...)\nconst otherStorage = createMMKV(...)\n\nconst importedCount = storage.importAllFrom(otherStorage)\n```\n\n### Check if an MMKV instance exists\n\nTo check if an MMKV instance exists, use `existsMMKV(...)`:\n\n```ts\nimport { existsMMKV } from 'react-native-mmkv'\n\nconst exists = existsMMKV('my-instance')\n```\n\n### Delete an MMKV instance\n\nTo delete an MMKV instance, use `deleteMMKV(...)`:\n\n```ts\nimport { deleteMMKV } from 'react-native-mmkv'\n\nconst wasDeleted = deleteMMKV('my-instance')\n```\n\n### Log Level\n\nBy default, MMKV logs at `Debug` level in debug builds and `Warning` level in release builds. You can override this at build time to control the verbosity of MMKV's native logs.\n\n| Value | Level |\n|-------|-------|\n| 0 | Debug |\n| 1 | Info |\n| 2 | Warning |\n| 3 | Error |\n| 4 | None |\n\n#### Android\n\nSet `MMKV_logLevel` in your app's `android\u002Fgradle.properties`:\n\n```properties\nMMKV_logLevel=4\n```\n\n#### iOS\n\nSet `$MMKVLogLevel` in your app's `ios\u002FPodfile`, then run `pod install`:\n\n```ruby\n$MMKVLogLevel = 4\n```\n\nOr use an environment variable during `pod install`:\n\n```sh\nMMKV_LOG_LEVEL=4 pod install\n```\n\n## Testing with Jest or Vitest\n\nA mocked MMKV instance is automatically used when testing with Jest or Vitest, so you will be able to use `createMMKV()` as per normal in your tests. Refer to [`example\u002F__tests__\u002FMMKV.harness.ts`](example\u002F__tests__\u002FMMKV.harness.ts) for an example using Jest.\n\n## Documentation\n\n* [Hooks](.\u002Fdocs\u002FHOOKS.md)\n* [Value-change Listeners](.\u002Fdocs\u002FLISTENERS.md)\n* [Migrate from AsyncStorage](.\u002Fdocs\u002FMIGRATE_FROM_ASYNC_STORAGE.md)\n* [Using MMKV with redux-persist](.\u002Fdocs\u002FWRAPPER_REDUX.md)\n* [Using MMKV with recoil](.\u002Fdocs\u002FWRAPPER_RECOIL.md)\n* [Using MMKV with mobx-persist-storage](.\u002Fdocs\u002FWRAPPER_MOBX.md)\n* [Using MMKV with mobx-persist](.\u002Fdocs\u002FWRAPPER_MOBXPERSIST.md)\n* [Using MMKV with zustand persist-middleware](.\u002Fdocs\u002FWRAPPER_ZUSTAND_PERSIST_MIDDLEWARE.md)\n* [Using MMKV with jotai](.\u002Fdocs\u002FWRAPPER_JOTAI.md)\n* [Using MMKV with react-query](.\u002Fdocs\u002FWRAPPER_REACT_QUERY.md)\n* [Using MMKV with Tinybase](.\u002Fdocs\u002FWRAPPER_TINYBASE.md)\n* [How is this library different from **react-native-mmkv-storage**?](https:\u002F\u002Fgithub.com\u002Fmrousavy\u002Freact-native-mmkv\u002Fissues\u002F100#issuecomment-886477361)\n\n## LocalStorage and In-Memory Storage (Web)\n\nIf a user chooses to disable LocalStorage in their browser, the library will automatically provide a limited in-memory storage as an alternative. However, this in-memory storage won't persist data, and users may experience data loss if they refresh the page or close their browser. To optimize user experience, consider implementing a suitable solution within your app to address this scenario.\n\n## Limitations\n\n- react-native-mmkv V4 requires react-native 0.74 or higher.\n- react-native-mmkv V4 requires [the new architecture](https:\u002F\u002Freactnative.dev\u002Fdocs\u002Fthe-new-architecture\u002Flanding-page)\u002FTurboModules to be enabled.\n- Since react-native-mmkv uses JSI for synchronous native method invocations, remote debugging (e.g. with Chrome) is no longer possible. Instead, you should use [Flipper](https:\u002F\u002Ffbflipper.com) or [React DevTools](https:\u002F\u002Freact.dev\u002Flearn\u002Freact-developer-tools).\n\n## Integrations\n\n### Rozenite\n\nUse [@rozenite\u002Fmmkv-plugin](https:\u002F\u002Fwww.rozenite.dev\u002Fdocs\u002Fofficial-plugins\u002Fmmkv) to debug your MMKV storage using Rozenite.\n\n### Reactotron\n\nUse [reactotron-react-native-mmkv](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Freactotron-react-native-mmkv) to automatically log writes to your MMKV storage using Reactotron. [See the docs for how to setup this plugin with Reactotron.](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Freactotron-react-native-mmkv)\n\n## Community Discord\n\n[**Join the Margelo Community Discord**](https:\u002F\u002Fmargelo.com\u002Fdiscord) to chat about react-native-mmkv or other Margelo libraries.\n\n## Adopting at scale\n\nreact-native-mmkv is provided _as is_, I work on it in my free time.\n\nIf you're integrating react-native-mmkv in a production app, consider [funding this project](https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fmrousavy) and \u003Ca href=\"mailto:me@mrousavy.com?subject=Adopting react-native-mmkv at scale\">contact me\u003C\u002Fa> to receive premium enterprise support, help with issues, prioritize bugfixes, request features, help at integrating react-native-mmkv, and more.\n\n## Contributing\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.\n\n## License\n\nMIT\n","react-native-mmkv 是一个为 React Native 应用设计的高性能键值存储库。其核心功能包括快速读写字符串、布尔值、数字和ArrayBuffers，支持加密存储及多实例管理，并允许自定义存储位置。技术上，该库通过直接的JSI绑定与C++原生库交互，实现了全同步调用，避免了异步操作带来的延迟，性能约为AsyncStorage的30倍。适用于需要高效本地存储解决方案的移动应用开发场景，特别适合对响应速度有高要求的应用。",2,"2026-06-11 03:28:19","top_topic"]