Challenge - 5 Problems
FlatList Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Why does FlatList improve performance with large data?
FlatList in React Native is designed to handle large lists efficiently. What is the main reason it improves performance compared to rendering all items at once?
Attempts:
2 left
💡 Hint
Think about how showing fewer items at a time can save resources.
✗ Incorrect
FlatList renders only visible items plus a small buffer, so it doesn't waste memory or CPU rendering items off-screen. This makes scrolling smooth even with large data.
❓ ui_behavior
intermediate2:00remaining
What happens when you scroll a FlatList?
When you scroll a FlatList with many items, what does FlatList do to keep performance smooth?
Attempts:
2 left
💡 Hint
Think about how it manages memory while you scroll.
✗ Incorrect
FlatList recycles item components by rendering only those visible and removing those off-screen, which keeps memory use low and scrolling smooth.
❓ lifecycle
advanced2:00remaining
How does FlatList reuse components internally?
FlatList reuses item components to improve performance. Which lifecycle behavior best describes this reuse?
Attempts:
2 left
💡 Hint
Think about how reusing components saves time and memory.
✗ Incorrect
FlatList recycles item components by changing their data props as you scroll, avoiding costly creation and destruction of components.
advanced
2:00remaining
How does FlatList handle item keys for efficient updates?
Why is providing a unique key to each FlatList item important for performance?
Attempts:
2 left
💡 Hint
Think about how React identifies elements to update efficiently.
✗ Incorrect
Unique keys let FlatList track items between renders, so it can update or recycle only changed items, improving performance.
📝 Syntax
expert2:00remaining
What is the output of this FlatList snippet?
Consider this FlatList code snippet:
const data = Array.from({length: 1000}, (_, i) => ({id: i.toString(), value: i}));
item.id}
renderItem={({item}) => {item.value} }
initialNumToRender={10}
/>
How many items will FlatList render initially on screen?
Attempts:
2 left
💡 Hint
Look at the initialNumToRender prop.
✗ Incorrect
The initialNumToRender prop tells FlatList how many items to render first. Here it is 10, so only 10 items render initially.