React Native interview question · Most asked

When would you use FlatList instead of ScrollView, and how do you make long lists fast?

Create a free account to save this page, take notes and track your progress. Sign in

Summary

Use FlatList (or SectionList) for long or unbounded lists: it virtualises, rendering only items near the screen. ScrollView renders every child at once.

Longer Answer

For speed: stable keyExtractor IDs; memoised row components with stable props; light rows; thumbnails sized for the row; tuning initialNumToRender, windowSize and maxToRenderPerBatch; getItemLayout when rows have a fixed height; and guarding onEndReached so pagination doesn't fire repeatedly. Very large lists can use a recycling list library.

Key Points

  • ScrollView renders everything; FlatList virtualises.
  • Stable keys, memoised rows, small images.
  • Tune window sizes; getItemLayout for fixed heights.

Deep dive: Mobile Apps with React Native and Expo: Lists with FlatList

Explanation

What interviewers look for

Understanding virtualisation and practical optimisation steps beyond 'use FlatList'.

Follow-up questions

  • Why not use the index as a key?
  • How do you implement infinite scrolling?

More most-asked React Native questions

← All React Native questions

Was this page helpful?