id, title, category, status, source_trust_level, verification_status, created_at, updated_at, tags, tech_stack, applied_in, aliases
| id |
title |
category |
status |
source_trust_level |
verification_status |
created_at |
updated_at |
tags |
tech_stack |
applied_in |
aliases |
| rn-asyncstorage-mmkv |
RN 로컬 저장 — AsyncStorage vs MMKV |
Coding |
draft |
B |
conceptual |
2026-05-09 |
2026-05-09 |
| react-native |
| storage |
| mmkv |
| vibe-coding |
|
| language |
applicable_to |
| TypeScript / react-native-mmkv |
|
|
|
| AsyncStorage |
| MMKV |
| encrypted storage |
| Keychain RN |
|
RN 로컬 저장
AsyncStorage 는 async + 느림 (특히 Android). MMKV (mmap key-value) 가 동기 + 30배 빠름. 비밀은 react-native-keychain (iOS Keychain / Android Keystore).
📖 핵심 개념
- AsyncStorage: 호환성 좋음. async. 큰 값 / 자주 read 시 느림.
- MMKV (Tencent): mmap. 동기 read. iOS/Android 모두.
- Keychain: 암호화 비밀.
💻 코드 패턴
MMKV
React hook
Keychain — 비밀
Migration AsyncStorage → MMKV
🤔 의사결정 기준
| 데이터 |
저장 |
| 단순 설정 (theme, locale) |
MMKV |
| 큰 list / 객체 (1MB+) |
SQLite (RN-WatermelonDB / op-sqlite) |
| 비밀 (token, password) |
Keychain |
| 영구 캐시 (이미지) |
FastImage / Expo FileSystem |
| 임시 in-memory |
useState / context |
| 새 RN 프로젝트 |
MMKV 디폴트 |
❌ 안티패턴
- AsyncStorage 에 token: 암호화 없음. iOS 백업 노출.
- MMKV 에 거대 JSON (수 MB): read/write 느림. SQLite.
- MMKV instance 매번 new: instance 한 번만 생성, export.
- encryptionKey 하드코딩: 부팅 시 Keychain 에서 받아오기.
- AsyncStorage 와 MMKV 혼용 + 동기화 X: stale.
- JSON.parse 후 catch 없음: corrupt 시 crash.
🤖 LLM 활용 힌트
- 신규 RN = MMKV. 비밀은 Keychain.
- 동기 read 가 hook 친화 — useMMKVString.
🔗 관련 문서