SectionList provides a convenient API for displaying sectioned data. While FlashList doesn’t have a dedicated SectionList component, you can achieve the same functionality with better performance using FlashList’s existing props.
Understanding the Difference
React Native’sSectionList has these props:
sections- Array of section objects with datarenderSectionHeader- Render header for each sectionrenderSectionFooter- Render footer for each sectionstickySectionHeadersEnabled- Make headers sticky
getItemType.
Migration Guide
Let’s migrate a contacts list fromSectionList to FlashList.
Flatten your data structure
Convert the nested section structure into a flat array where headers are mixed with data:
Complete Example
Here’s a full implementation with TypeScript:Advanced Patterns
Section Footers
Add footers between sections:Section Separators
Add visual separators between sections:Dynamic Data Transformation
Create a helper function to transform section data:Comparison
- SectionList Approach
- FlashList Approach
Pros:
- Familiar API for RN developers
- Data structure matches visual hierarchy
- Built-in section support
- Poor performance with large datasets
- Limited customization
- Higher memory usage
Performance Tips
Use getItemType
Always implement
getItemType to enable proper view recycling between different item types.Memoize computations
Use
useMemo for sticky header indices and data transformations to avoid unnecessary recalculations.Optimize renderItem
Extract render logic into memoized components to prevent unnecessary re-renders.
Why This Approach?
FlashList uses a flat data structure because:Better recycling performance
Better recycling performance
A flat structure allows FlashList to recycle views more efficiently across the entire list, not just within sections.
Simplified state management
Simplified state management
Updates and mutations are simpler with a single array rather than nested section structures.
More flexible
More flexible
You have complete control over how sections, headers, and footers are rendered and styled.
Better TypeScript support
Better TypeScript support
Union types provide better type safety than the generic section structure.
Related
Sticky Headers
Learn more about implementing sticky headers
getItemType
Understand how item types improve performance