Recall & Review
beginner
What is a SectionList in React Native?
SectionList is a component that renders a list with sections, allowing you to group data under headers for better organization and readability.
Click to reveal answer
beginner
How do you define the data structure for a SectionList?
You provide an array of objects, where each object has a
title (or key) for the section header and a data array containing the items for that section.Click to reveal answer
beginner
Which prop is used to render the header for each section in a SectionList?
The
renderSectionHeader prop is a function that returns the UI for each section header.Click to reveal answer
intermediate
Why use SectionList instead of FlatList for grouped data?
SectionList automatically handles grouping and rendering section headers, making it easier to display grouped lists without manually managing headers.
Click to reveal answer
beginner
What is the purpose of the
keyExtractor prop in SectionList?It provides a unique key for each item in the list to help React Native optimize rendering and track items efficiently.
Click to reveal answer
What type of data structure does SectionList expect for its
sections prop?✗ Incorrect
SectionList requires an array where each element has a
title (or similar) and a data array for items.Which prop renders the items inside each section of a SectionList?
✗ Incorrect
renderItem defines how each item in the section's data array is displayed.What happens if you omit the
keyExtractor in a SectionList?✗ Incorrect
Without a unique key, React Native falls back to using indexes, which can cause inefficient rendering or bugs.
Which of these is a benefit of using SectionList for grouped data?
✗ Incorrect
SectionList helps by rendering section headers automatically for grouped data.
How do you style the section headers in a SectionList?
✗ Incorrect
You control header styles by returning a styled component inside
renderSectionHeader.Explain how to set up a SectionList to display grouped data with headers.
Think about how you organize a grocery list by categories.
You got /4 concepts.
Describe the role of keyExtractor in SectionList and why it is important.
Imagine labeling each item so you can find it quickly.
You got /4 concepts.