View All
View All
View All
View All
View All
View All
View All
View All
View All
View All
View All
View All

React Native FlatList Component [2025 Beginner's Guide]

By Pavan Vadapalli

Updated on May 19, 2025 | 11 min read | 16.38K+ views

Share:

 

Did you know? React Native's FlatList just got even more powerful! With the latest performance-boosting tweaks like removeClippedSubviews, maxToRenderPerBatch, updateCellsBatchingPeriod, and initialNumToRender, you can slash memory usage and supercharge responsiveness — perfect for those complex, data-heavy lists! 

FlatList is a powerful React Native component designed to render a scrollable list of items with optimal performance. Unlike traditional lists, FlatList only renders items that are currently visible on the screen, making it highly efficient for handling large datasets. It simplifies the process by eliminating the need for manually looping through data, allowing you to simply provide an array of items, and let FlatList do the heavy lifting.

In this blog, you'll explore FlatList's core props, methods, and performance boosting features like lazy loading. Learn how to optimize, customize, and implement React FlatList for enhanced app performance and design.

Master JavaScript libraries like React to develop dynamic, interactive websites and applications. Enroll in upGrad’s Online Software Development Courses and build your career in web development. Join today!

What is FlatList in React Native?

FlatList is a core React Native component designed to efficiently render large lists of data in a scrollable format. Unlike traditional methods, where you would need to manually loop through and render each item, FlatList takes care of the heavy lifting for you by automatically rendering only the items that are currently visible on the screen. This means better performance and smoother scrolling, especially with large datasets.

The demand for skilled professionals is growing rapidly in the industry. Equip yourself with the knowledge and expertise by exploring these top courses!

For example, imagine you're building a form where users can select a country, state, or province from a list. Instead of manually writing a loop to display each country, FlatList allows you to simply provide an array of countries, and it will render them with minimal code. 

With a foundational understanding of FlatList, let's move ahead and explore the essential aspects of the FlatList component and how it enhances performance in React Native.

An Introduction to FlatList Component

The FlatList component is perfect for displaying structured, dynamic data in a scrollable view. When using FlatList, React Native renders only the currently visible items, meaning it doesn't load every item at once — making it much more memory-efficient.

Basic Syntax of FlatList:

<FlatList
  data={DataContainer} // the array of data to render
  renderItem={yourRenderItem} // function to render each item
  keyExtractor={item => item.id} // unique key for each item
/>

Key Concepts:

  • data: This is the array of data you want to display in the list. For example, it could be a list of countries, products, or even dynamic data fetched from an API.
  • renderItem: This is a function that takes an item from the data array and returns how that item should be displayed. It could be a simple view with a Text component or a more complex component with images, buttons, or other elements.

Example:

Let’s say you have an array of country names and you want to render them in a list. Here’s how you might use FlatList:

import React from 'react';
import { FlatList, Text, View, StyleSheet } from 'react-native';

const countries = [
  { id: '1', name: 'United States' },
  { id: '2', name: 'Canada' },
  { id: '3', name: 'Australia' },
  { id: '4', name: 'India' },
  { id: '5', name: 'United Kingdom' },
];

const renderItem = ({ item }) => (
  <View style={styles.item}>
    <Text>{item.name}</Text>
  </View>
);

export default function App() {
  return (
    <FlatList
      data={countries}
      renderItem={renderItem}
      keyExtractor={item => item.id}
    />
  );
}

const styles = StyleSheet.create({
  item: {
    backgroundColor: 'lightblue',
    padding: 20,
    marginVertical: 8,
    marginHorizontal: 16,
    borderRadius: 8,
  },
});

Example of the Output:

-------------------------------------------------------
| United States                                        |
-------------------------------------------------------
| Canada                                              |
-------------------------------------------------------
| Australia                                            |
-------------------------------------------------------
| India                                               |
-------------------------------------------------------
| United Kingdom                                       |
-------------------------------------------------------

This code will render a scrollable list of country names, where each item is styled with padding, margin, and a background color. Notice how the keyExtractor prop helps React Native keep track of each item, ensuring efficient rendering and updates.

Become a top-tier full-stack developer by learning AI tools like OpenAI and GitHub Copilot, and work on hands-on projects. Join upGrad’s Full Stack Development Bootcamp and get personalized mentorship for career growth.

Also Read: React Functional Components with Examples [In-Depth Guide]

Now that we've understood the basics of the FlatList component, let's explore its various props that allow you to customize and control its behavior in React Native.

Props in FlatList React Native

As recently discussed, props means properties. They are extra ingredients passed into a component. A component may have both required and optional props needed for utilizing it.

Let’s take a look at the props encapsulated within a FlatList component. 

Prop

Description

ItemSeparatorComponent Renders a space between each item.
ListEmptyComponent Displays when the list is empty.
ListFooterComponent Displays at the bottom of all items.
ListFooterComponentStyle Styles the internal view of the ListFooterComponent.
ListHeaderComponent Displays at the top of all items.
ListHeaderComponentStyle Styles the internal view of the ListHeaderComponent.
columnWrapperStyle Custom style used for multi-item rows.
extraData Triggers re-rendering of the list when the data changes.
getItemLayout Optimizes rendering by skipping dynamic content measurement when item size is known.
horizontal If true, renders items horizontally instead of vertically.
initialNumToRender Specifies the number of items to render in the first batch.
initialScrollIndex Starts from the item at the given index instead of the top item.
inverted Reverses the scroll direction.
numColumns Displays items in multiple columns.
onEndReached Called when the scroll position is within the rendered content, used for pagination.
onEndReachedThreshold Defines how close you need to be to the end before triggering onEndReached.
onRefresh Adds a RefreshControl when provided.
onViewableItemsChanged Invoked when the visibility of an item changes.
progressViewOffset Defines the loading offset on Android devices.
refreshing Set to true when waiting for new data during a refresh.
removeClippedSubviews Improves scroll performance by removing off-screen items (default is true on Android).
viewabilityConfigCallbackPairs Displays a list of viewability config callback pairs.

If you want to improve your understanding of ML algorithms, upGrad’s Executive Diploma in Machine Learning and AI can help you. This program offers a strong hands-on approach, enabling you to apply theoretical knowledge to real-world challenges. It prepares you for high-demand roles such as AI Engineer and Machine Learning Specialist.

Also Read: React useEffect() Hook: Structure, Usage, Examples & Tips

After understanding the essential props in React Native FlatList, let’s explore its basic structure to see how these props integrate into the component for effective rendering.

Coverage of AWS, Microsoft Azure and GCP services

Certification8 Months

Job-Linked Program

Bootcamp36 Weeks

Basic Structure of React Native FlatList

The FlatList structure is simple and can be achieved with one line of code only; see the code snippet below.

<FlatList data={} renderItem={} keyExtractor={item => item.id} />

Isn’t that super simple? Well, that’s for the basics. To spice it up a little, we pass in some props to it, props mean properties. Think about it this way, to make a dish taste better; you will need to add some more ingredients.

There are some primary and optional react props that you can pass into a FlatList to render some items that meet your desired result.

A. Primary Props

What are the three key props used in a FlatList? The primary props are the key properties that make your FlatList render items on the screen, and they include;

  • data: This accepts the array of items you want to pass into the FlatList.
  • renderItem: This includes the individual items you wish to display represented by (item, index, and separator). Each item has an index, a function that you can use to modify the item before rendering.
  • keyExtractor: This prop is used to extract the unique key for a given item.

With the above properties, your FlatList is ready to render your items on the screen; let’s look at the optional properties...

B. Optional Props

When you are asked what is extra data in FlatList? You should know that extra data are optional props. And they are the non-compulsory properties available in the FlatList component for rendering a list item. Listed below are some of the extra properties available for your usage.

Also Read: React JS Architecture: Implementation, Core Components, Best Practices and More for 2025

Having understood the basic structure of React Native FlatList, it’s important to look at the advantages it brings to developers for creating seamless and high-performance applications.

 

 

Benefits of React Native FlatList Components

 

Before we talk more about the FlatList component, let us understand the benefits of the component. The component offers various advantages that simplify rendering dynamic lists in React Native. Here are some of the key benefits:

  1. Smooth Scrolling and Efficient Rendering: FlatList optimizes performance by rendering only the visible items on the screen. This ensures smoother scrolling and better performance, especially with large datasets, compared to rendering the entire list at once.
  2. Customizable and Flexible: FlatList provides customization options for how things are rendered, allowing us to modify the appearance of each item based on unique requirements. This adaptability allows for the construction of distinctive and compelling user interfaces.
  3. Dynamic and Scalable: It efficiently handles large lists of data without compromising on performance. Whether it's a few items or thousands, FlatList adapts, making it suitable for various app scenarios without sacrificing user experience.
  4. Seamless Integration with Data Sources: It easily integrates with various data sources like arrays, making it straightforward to manage and display data fetched from APIs or local storage.
  5. Optimized for Touch Interactions: It handles touch events efficiently, supporting interactions like tap, swipe, and hold gestures on list items. This makes it ideal for applications requiring user interactions within a scrollable list.

Also Read: Skills to Become a Full-Stack Developer in 2025

With a solid understanding of the benefits of React Native FlatList, it's time to explore the syntax and walk through some examples of its usage.

React Native FlatList Syntax (With Sample Usage)

How do you show data in FlatList in react-native? Below is an example of how you can quickly use FlatList in your next React Native project…

Example #1

import * as React from 'react';
import { FlatList, Text, View, StyleSheet } from 'react-native';
# A component to render individual item
const Item = ({name}) => {
return(
<View style={styles.item}>
<Text style={{color: 'black'}}>{name}</Text>
</View>
);
}
export default function App() {
# A datalist of countries to render
const countries = [
{
id: '1',
name: 'United States',
},
{
id: '2',
name: 'United Kingdom',
},
{
id: '3',
name: 'Israel',
},
{
id: '4',
name: 'India',
},
{
id: '5',
name: 'Nigeria',
},
{
id: '6',
name: 'Uganda',
},
];
# An item renderer
const renderItem = ({item})=>(
<Item name={item.name}/>
);
return (
<View style={styles.container}>
<FlatList
data={countries}
renderItem={renderItem}
keyExtractor={(item) => item.id}
/>
</View>
);
}
const styles = StyleSheet.create({
container: {
marginTop:30,
padding:2,
},
item: {
backgroundColor: 'orange',
padding: 20,
marginVertical: 8,
marginHorizontal: 16,
borderRadius: 8,
shadowColor: '#000',
shadowOffset: { width: 3, height: 3 },
shadowOpacity: 0.3,
shadowRadius: 8,
},
});
</> Copy Code

And this is what the piece of code above looks like…

Having covered the core syntax and usage of FlatList, we can now explore its methods, which provide powerful features for manipulating and optimizing lists in React Native.

Methods of FlatList in React Native

Methods are functions that can be found in a class. Each React Native component is its class. It not only carries props but also has some methods that allow the FlatList to perform certain actions.

For example, when an event is triggered, these methods can perform certain operations. Let's take a closer look at them.

  • flashScrollIndicators(): Displays the scroll indicators for a brief period.
  • getNativeScrollRef(): returns a pointer to the underlying scroll component.
  • getScrollResponder(): This method returns the handle to the underlying scroll responder.
  • getScrollableNode(): This method returns the handle to the underlying scroll node.
  • recordInteraction(): This method returns a list of all interactions that have occurred.
  • scrollToEnd(): This method scrolls to the end of the content.
  • scrollToIndex(): This method scrolls to a specific item whose index is provided.
  • scrollToItem(): This method scrolls to a specified item. It necessitates a linear scan of the data.
  • scrollToOffset(): This method scrolls the list to a specific content pixel offset.

Develop the skills to create interactive web applications and build fully functional websites using JavaScript. Join the free course on JavaScript Basics from Scratch. Start learning today!

Also Read: 40 Must-Try JavaScript Project Ideas for Developers of All Levels

While the methods of FlatList focus on managing its behavior and data rendering, understanding its key properties is crucial for customizing its functionality and optimizing performance.

 

Important Properties of FlatList

FlatList is a container for listing items that can be loaded. It has header and footer support, multiple column support, vertical/horizontal scrolling, lazy loading, etc. Here are some of FlatList's key features.

  • Includes scroll loading
  • Allows you to adjust the scroll using ScrolltoIndex support
  • It supports headers and footers
  • Multiple column layouts
  • Cross-platform
  • Configurable viewability callbacks

With the essential properties of FlatList outlined, let’s now explore some practical examples to better understand its implementation in React Native.

Examples of React Native FlatLists

How do you make a FlatList horizontal? A horizontal FlatList can easily be achieved by passing the horizontal prop inside the FlatList React Native component, as seen in the image below.

Example #2

<FlatList
data={countries}
renderItem={renderItem}
keyExtractor={(item) => item.id}
horizontal
/>

How do you optimize FlatList? As seen in the following example, you can easily optimize a FlatList by breaking it down into components.

Example #3

In this example, we will be spicing up our countries list by adding a third parameter to our datatype; here is what the process looks like...

const countries = [
{
id: '1',
name: 'country name',
isSelected: true,
},
...,
...,
];

Modify the Item component code to look like this…

const Item = ({ name, isSelected }) => {
return (
<View
style={[
styles.item,
{ borderColor: isSelected ? 'red' : 'black' },
{ borderWidth: isSelected ? 2 : 0 },
]}>
<Text
style={{
fontWeight: 500,
color: 'black',
}}>
{name}
</Text>
</View>
);
};

Include the renderItem method as before...

const renderItem = ({ item }) => (
<Item name={item.name} isSelected={item.isSelected} />
);
Display the FlatList React Native component as before…
return (
<View style={styles.container}>
<FlatList
data={countries}
renderItem={renderItem}
keyExtractor={(item) => item.id}
/>
</View>
);

Update the stylesheet like this…

const styles = StyleSheet.create({
container: {
marginTop: 30,
padding: 2,
},
item: {
padding: 20,
marginVertical: 8,
marginHorizontal: 16,
borderRadius: 8,
shadowColor: '#000',
shadowOffset: { width: 3, height: 3 },
shadowOpacity: 0.3,
shadowRadius: 8,
},
});

The above codes should produce this result, as seen below…

With the above example, you can specify which country is to be selected by the boolean key supplied in the countries data list.

You can do a lot more with FlatList; you can try doing some new examples, such as adding a FlatList loading indicator or some animation to the FlatList component.

Also Read: Routing in ReactJS for Beginners [With Examples]

While FlatLists are great for rendering lists efficiently, understanding how to customize them can enhance the user experience and give you greater control over the design and functionality.

 

React Native FlatList Customization

Customizing a FlatList in React Native provides numerous possibilities for modifying the list's design and behavior. We can improve the user experience by adjusting the FlatList to unique design and interaction requirements using various props and capabilities. 

The 'renderItem' prop stands as a foundation, enabling custom rendering of each item in the list. This prop allows us to create unique components or views for individual items, to craft diverse and engaging layouts.

Additionally, the 'ListHeaderComponent' and 'ListFooterComponent' props allow us to insert custom header and footer elements, which improves the list's organization. 'ItemSeparatorComponent' makes it easier to include separators between items, which contributes to greater visual hierarchy and clarity.

Furthermore, the 'onEndReached' and 'onRefresh' props allow for fine-tuning interactions by providing actions when the user reaches the end of the list or begins a refresh gesture.

FlatList's wide customization options enable us to create visually appealing, dynamic, and functional lists that are suited to specific application requirements.

Ready to dive deeper into React? Take your first step towards mastering React JS with upGrad's ReactJS Free Course for Beginners. This course is perfect for building a strong foundation in React’s core concepts, including hooks, components, and architecture.

While customizing a FlatList offers fine control over its appearance and behavior, understanding how it compares to ScrollView is crucial for selecting the right component for your app.

 

 

React Native FlatList vs ScrollView

 

FlatList is best for handling large and dynamic datasets with smooth performance, while ScrollView works better for smaller datasets or static content. For optimal performance, especially with larger data, FlatList is the go-to choice.

Here’s a table comparing React Native FlatList and ScrollView.

Feature FlatList ScrollView
Purpose Optimized for rendering large datasets efficiently. Versatile container for various components and views.
Rendering Renders only visible items, saving memory and improving performance. Renders all items at once, which can be inefficient for large datasets.
Performance High performance with lazy loading and virtual rendering. Less efficient for large datasets.
Ideal Use Cases Dynamic lists like social media feeds, product displays, etc. Small datasets or simple use cases with limited items.
Data Handling Integrates easily with data sources and supports key-based rendering. Does not optimize data handling for large lists.
Touch Handling Built-in touch handling for interactive lists. Requires custom implementation for touch events.

Also Read: 10 Practical Applications of JavaScript And Career Tips

Having compared React Native FlatList and ScrollView, you can enhance your understanding of React further with upGrad’s in-depth learning programs designed for professionals.

Level up Your Skills in React with upGrad!

React Native's FlatList component makes rendering large, dynamic lists efficient and straightforward. It optimizes performance by only loading visible items, reducing memory usage and improving responsiveness. With customizable props, you can easily adjust the appearance and behavior of lists to suit your needs.

To further enhance your React Native skills, upGrad’s courses offer structured learning and hands-on experience. With expert support and practical projects, you'll build the expertise to tackle more complex development challenges and advance your career.

In addition to the programs mentioned above, here are some more free courses to further enhance your learning and skills in React:

You can contact upGrad’s expert career counselors, who will guide you based on your goals. You can also visit a nearby upGrad offline center to explore course options, get hands-on experience, and speak directly with mentors!

Unlock your potential with our free Software Development courses, designed to equip you with the skills and knowledge needed to excel in the tech world. Start learning today and advance your career!

Master the most in-demand software development skills that employers are looking for. From coding languages to development frameworks, these skills will help you stand out in the tech industry.

References:

https://reactnative.dev/docs/optimizing-flatlist-configuration

 

Frequently Asked Questions (FAQs)

Q1. How do I handle large datasets with FlatList in React Native?

Q2. What is the difference between FlatList and ScrollView in React Native?

Q3. How can I make a horizontal FlatList?

Q4. How do I add custom headers and footers in FlatList?

Q5. What does the extraData prop do in FlatList?

Q6. How can I enable pull-to-refresh functionality in FlatList?

Q7. Can I optimize FlatList performance for lists with dynamic item heights?

Q8. What is the removeClippedSubviews prop used for?

Q9. How do I handle item selection in FlatList?

Q10. How do I paginate data with FlatList?

Q11. What is the purpose of the keyExtractor prop in FlatList?

Pavan Vadapalli

900 articles published

Director of Engineering @ upGrad. Motivated to leverage technology to solve problems. Seasoned leader for startups and fast moving orgs. Working on solving problems of scale and long term technology s...

Get Free Consultation

+91

By submitting, I accept the T&C and
Privacy Policy

India’s #1 Tech University

Executive PG Certification in AI-Powered Full Stack Development

77%

seats filled

View Program

Top Resources

Recommended Programs

upGrad

AWS | upGrad KnowledgeHut

AWS Certified Solutions Architect - Associate Training (SAA-C03)

69 Cloud Lab Simulations

Certification

32-Hr Training by Dustin Brimberry

upGrad

Microsoft | upGrad KnowledgeHut

Microsoft Azure Data Engineering Certification

Access Digital Learning Library

Certification

45 Hrs Live Expert-Led Training

upGrad

upGrad KnowledgeHut

Professional Certificate Program in UI/UX Design & Design Thinking

#1 Course for UI/UX Designers

Bootcamp

3 Months