Challenge - 5 Problems
Offline Data Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
Why does storing data locally help offline use?
Imagine you want to use a mobile app without internet. Why does saving data on your device help?
Attempts:
2 left
💡 Hint
Think about what happens when you have no internet connection.
✗ Incorrect
Local data means the app keeps a copy of information on your device. So even without internet, the app can show you that saved info.
❓ ui_behavior
intermediate1:30remaining
What happens to app behavior when local data is used offline?
If an app uses local data storage, what will the user see when offline?
Attempts:
2 left
💡 Hint
Think about how local data helps the app behave without internet.
✗ Incorrect
Using local data means the app can display saved content even when offline, so users still see useful info.
❓ lifecycle
advanced2:00remaining
When should an app update local data for offline use?
To keep offline data useful, when should the app update its local storage?
Attempts:
2 left
💡 Hint
Think about how the app stays current with new info.
✗ Incorrect
The app should update local data whenever it can connect to the internet and new info exists, so offline data stays fresh.
advanced
2:00remaining
How does local data affect app navigation offline?
If an app uses local data, what happens when a user navigates to a screen needing data while offline?
Attempts:
2 left
💡 Hint
Consider how local data supports screen content without internet.
✗ Incorrect
Local data allows screens to load content from device storage, so navigation works smoothly offline.
🔧 Debug
expert2:30remaining
Why does this offline app fail to show saved data?
An app saves data locally but shows blank screens offline. What is a likely cause?
React Native
useEffect(() => {
fetch('https://api.example.com/data')
.then(response => response.json())
.then(json => {
setData(json);
AsyncStorage.setItem('localData', JSON.stringify(json));
});
}, []);
useEffect(() => {
AsyncStorage.getItem('localData').then(saved => {
if (saved) setData(JSON.parse(saved));
});
}, []);Attempts:
2 left
💡 Hint
Think about the order of data loading and fetching when offline.
✗ Incorrect
The fetch tries to get online data after loading local data. When offline, fetch fails and may overwrite local data with empty or undefined, causing blank screens.