MMKV - Good bye AsyncStorage
Almost every mobile application need to store some data locally for authetication of setup reasons. On React Native the way to go is (or used to be) using the AsyncStorage - storage system.
But performance was not the strengths of the AsyncStorage system! Now a new alternative (about 30x faster) is available for React Native derived from MMKV.
MMKV is an efficient, small, easy-to-use mobile key-value storage framework used in the WeChat application. It's currently available on Android, iOS/macOS, Win32 and POSIX.
The react-native-mmkv is a library that allows you to easily use MMKV inside your React Native applications. It provides fast and direct bindings to the native C++ library which are accessible through a simple JS API.
Features
- Get and set strings, booleans and numbers
- Fully synchronous calls, no async/await, no Promises, no Bridge.
- Encryption support (secure storage)
- Multiple instances support (separate user-data with global data)
- Customize storage location
- High performance because everything is written in C++
- ~30x faster than AsyncStorage
- Uses JSI instead of the "old" Bridge
- iOS, Android and Web support
- Easy to use React Hooks API