0
0
React Nativemobile~10 mins

MMKV for fast storage in React Native - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import MMKV storage in React Native.

React Native
import { [1] } from 'react-native-mmkv';
Drag options to blanks, or click blank then click option'
AMMKV
BStorage
CuseMMKV
DAsyncStorage
Attempts:
3 left
💡 Hint
Common Mistakes
Using AsyncStorage instead of MMKV
Importing a wrong name like Storage or useMMKV
2fill in blank
medium

Complete the code to create a new MMKV storage instance.

React Native
const storage = new [1]();
Drag options to blanks, or click blank then click option'
AMMKV
BStorageManager
CStorage
DAsyncStorage
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to instantiate AsyncStorage which is not a class
Using wrong class names like Storage or StorageManager
3fill in blank
hard

Fix the error in the code to save a string value with MMKV.

React Native
storage.[1]('username', 'Alice');
Drag options to blanks, or click blank then click option'
Aput
Bsave
Cstore
DsetString
Attempts:
3 left
💡 Hint
Common Mistakes
Using save or put which are not MMKV methods
Trying to use AsyncStorage methods
4fill in blank
hard

Fill both blanks to read a string value and provide a default if missing.

React Native
const name = storage.[1]('username') || [2];
Drag options to blanks, or click blank then click option'
AgetString
B'Guest'
CsetString
Dnull
Attempts:
3 left
💡 Hint
Common Mistakes
Using setString instead of getString to read
Using null instead of a default string
5fill in blank
hard

Fill all three blanks to remove a stored key and check if it exists.

React Native
storage.[1]('username');
const exists = storage.[2]('username');
console.log(exists === [3]);
Drag options to blanks, or click blank then click option'
Adelete
Bcontains
Cfalse
Dremove
Attempts:
3 left
💡 Hint
Common Mistakes
Using remove which is not a method
Checking existence with wrong method
Comparing existence to true instead of false