React Native FlatList
The FlatList component displays the similar structured data in a scrollable list. It works well for large lists of data, where the number of list items might change over time. The FlatList shows only those renders elements which are currently displaying on the screen, not all the elements of the list at once.
The FlatList takes two required props: data and renderItem.
The data is the source of elements for the list, and renderItem takes one item from the source and returns a formatted component to render.
To implement the FlatList component, we need to import FlatList library from 'react-native'.
React Native FlatList Example
In this example, we provide hardcoded elements to data. Each element in the data props is rendered as a Text component.
The ItemSeparatorComponent prop of FlatList is used to implement the separator between the elements of the list. To perform an event on clicking the element, add the onPress prop.