Recall & Review
beginner
What is AsyncStorage in React Native?
AsyncStorage is a simple, unencrypted, asynchronous, persistent, key-value storage system for React Native apps. It lets you save data locally on the device.
Click to reveal answer
beginner
How do you save a value with AsyncStorage?
Use AsyncStorage.setItem(key, value) to save a string value under a key. It returns a Promise that resolves when the data is saved.
Click to reveal answer
beginner
How do you read a value from AsyncStorage?
Use AsyncStorage.getItem(key) to get the value stored under the key. It returns a Promise that resolves to the string value or null if not found.
Click to reveal answer
intermediate
Why is AsyncStorage asynchronous?
AsyncStorage is asynchronous to avoid blocking the app’s user interface while reading or writing data, keeping the app smooth and responsive.
Click to reveal answer
intermediate
Can AsyncStorage store objects directly?
No, AsyncStorage stores only strings. To save objects, convert them to strings using JSON.stringify before saving, and parse them back with JSON.parse when reading.
Click to reveal answer
Which method saves data in AsyncStorage?
✗ Incorrect
setItem is used to save a key-value pair in AsyncStorage.
What type of data does AsyncStorage store?
✗ Incorrect
AsyncStorage stores only strings. Objects must be converted to strings first.
Why should AsyncStorage operations be asynchronous?
✗ Incorrect
AsyncStorage is asynchronous to avoid blocking the UI thread and keep the app smooth.
How do you retrieve a value from AsyncStorage?
✗ Incorrect
getItem(key) returns the stored string value for the given key.
What should you do before saving an object in AsyncStorage?
✗ Incorrect
Objects must be converted to strings using JSON.stringify before saving.
Explain how to save and retrieve a user name using AsyncStorage in React Native.
Think about saving a string under a key and reading it back asynchronously.
You got /5 concepts.
Describe why AsyncStorage uses asynchronous methods and how that benefits app performance.
Consider what happens if storage was synchronous and how it affects the app.
You got /4 concepts.