Difference between ScrollView and Flatlist
ScrollView | FlatList |
---|---|
It does not provide any memory management. | It provides automatic memory management. |
It loads all the content at once. | It loads content as the window scrolled. |
It results in slow rendering and increased memory usage. | It does not affect the rendering speed. |
It maintains the component state. | It does not maintain the component state. |
It renders generic content in a scrollable container. | It renders a list of similar items. |
Can be imported from react native as: import {ScrollView} from ‘react-native’; |
Can be imported from React Native as: import {FlatList} from ‘react-native’; |
When we use ScrollView over FlatList or vice-versa ?
In the landscape of mobile app development, the task of displaying lists of data is commonplace. Developers often find themselves contemplating whether to employ a ScrollView or a FlatList component for this purpose. Both ScrollView and FlatList are pivotal components in widely used frameworks like React Native, each presenting its unique benefits and applicability.
Table of Content
- ScrollView
- When to use ScrollView?
- Flatlist
- When to use FlatList?
- Difference between ScrollView and Flatlist
Contact Us