Skip to main content
InterviewHubPRO
Section Overview
Q15

Question 15 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

30%
React Native & Expo (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

What is MMKV and why does it replace `AsyncStorage`?

senior LevelMost AskedCode ExampleAsync & PromisesSystem Design

In Simple Words:

  • AsyncStorage (Legacy): Key-value store backed by SQLite on Android and serial plist files on iOS. Asynchronous: Every read/write must await a promise over the bridge. Slow (tens of milliseconds).
  • react-native-mmkv: Key-value storage engine developed by WeChat:
    • Uses memory-mapped files (mmap) via C++ and JSI.
    • Synchronous: storage.getString('token') returns instantly!
    • Up to 30x faster than AsyncStorage with zero thread hopping.
typescript
import { MMKV } from "react-native-mmkv";
export const storage = new MMKV();

// Synchronous read & write:
storage.set("user.theme", "dark");
const theme = storage.getString("user.theme"); // Instant return!