{"id":8638,"date":"2025-02-28T12:50:54","date_gmt":"2025-02-28T07:20:54","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=8638"},"modified":"2025-02-28T12:50:59","modified_gmt":"2025-02-28T07:20:59","slug":"flatlist","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/flatlist\/","title":{"rendered":"FLATLIST"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Introduction:<br> FlatList is a core React Native component used to efficiently render lists of data. It is optimized for handling large datasets by rendering only the currently visible items, making it a better choice than ScrollView when displaying long lists.<br><br><br>Steps<br>Step1: We need to define the data for rendering. If we have one or two data items, they can be hardcoded in the mobile UI. However, if we have a large amount of data, we can use FlatList to render it efficiently<br>Step2:We need to import FlatList in the screen where we want to use it in react native project.<br>Step3: Core structure for implementing the Flatlist in the react native <br>   <strong>&lt;FlatList data={} renderItem={} keyExtractor={item =&gt; item.id} \/&gt;<\/strong><br>      <br>       <strong>data={}<\/strong>: This prop holds the array of data that will be displayed in the list.<br>       <strong>renderItem={}<\/strong>: This function defines how each item in the list should be displayed. It receives an              object containing the item and returns a React component.<br>       <strong>keyExtractor={item =&gt; item.id}: <\/strong>This function assigns a unique key to each item in the list using the<strong> id <\/strong>property. It helps React optimize re-renders by efficiently tracking items.<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-28-at-12.52.51.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"741\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-28-at-12.52.51-1024x741.png\" alt=\"\" class=\"wp-image-8646\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-28-at-12.52.51-1024x741.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-28-at-12.52.51-300x217.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-28-at-12.52.51-768x555.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-28-at-12.52.51-1536x1111.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-28-at-12.52.51-2048x1481.png 2048w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-28-at-12.52.51-415x300.png 415w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Consulsion:<br>FlatList is a highly efficient and flexible component in React Native for rendering large lists. Unlike ScrollView, it optimizes performance by rendering only visible items, making it ideal for handling dynamic and extensive datasets.<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: FlatList is a core React Native component used to efficiently render lists of data. It is optimized for handling [&hellip;]<\/p>\n","protected":false},"author":505,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[],"class_list":["post-8638","post","type-post","status-publish","format-standard","hentry","category-web-architecture","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/shn2x7-flatlist","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8638","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/505"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=8638"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8638\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=8638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=8638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=8638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}