{"id":5352,"date":"2022-11-19T09:52:33","date_gmt":"2022-11-19T14:52:33","guid":{"rendered":"https:\/\/www.cloudsurph.com\/?p=5352"},"modified":"2022-11-26T08:08:10","modified_gmt":"2022-11-26T13:08:10","slug":"reactjs-how-to-use-lists-and-keys-in-react","status":"publish","type":"post","link":"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/","title":{"rendered":"ReactJS: How to use Lists and Keys in React"},"content":{"rendered":"<p>In this article, we can try to define ReactJS: how to use Lists and Keys, react Lists and Keys, and how can we use Lists and Keys in react.<\/p>\n<h3>Basic List Component<\/h3>\n<p>Usually, we would render lists inside a component. We can refactor the example of the previous article into a component that accepts an array of numbers and outputs a list of elements.<\/p>\n<pre class=\"prettyprint\">function NumberList(props) {\r\n\u00a0 const numbers = props.numbers;\r\n\u00a0 const listItems = numbers.map((number) =&gt;\r\n\u00a0 \u00a0 &lt;li&gt;{number}&lt;\/li&gt;\r\n\u00a0 );\r\n\u00a0 return (\r\n\u00a0 \u00a0 &lt;ul&gt;{listItems}&lt;\/ul&gt;\r\n\u00a0 );\r\n}\r\nconst numbers = [1, 2, 3, 4, 5];\r\nconst root = ReactDOM.createRoot(document.getElementById('root'));\r\nroot.render(&lt;NumberList numbers={numbers} \/&gt;);\r\n<\/pre>\n<p>In this case, when you run this code, you\u2019ll be given a warning that a key should be provided for list items.<\/p>\n<p>Also, a \u201c<strong>key<\/strong>\u201d is a special string attribute we need to include when creating lists of elements.<\/p>\n<h5><em><strong>You can purchase your\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">hosting from Cloudsurph.com<\/a>,\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">Cloudsurph hosting<\/a>\u00a0is a reliable hosting option for business and personal projects. We offer insight and help on system configuration issues and code errors or bugs<\/strong>.<\/em><\/h5>\n<p>So, let\u2019s assign a key to our list of items inside <strong>numbers.map()<\/strong> and fix the missing key issue like the below example.<\/p>\n<pre class=\"prettyprint\">function NumberList(props) {\r\nconst numbers = props.numbers;\r\nconst listItems = numbers.map((number) =&gt;\r\n&lt;li key={number.toString()}&gt;\r\n{number}\r\n&lt;\/li&gt;\r\n);\r\nreturn (\r\n&lt;ul&gt;{listItems}&lt;\/ul&gt;\r\n);\r\n}\r\n<\/pre>\n<h3>Keys<\/h3>\n<p>Here, Keys help React identity which items have changed, are removed, or are added. Also, Keys should be given to the elements inside the array to give the elements a stable identity like the below example:<\/p>\n<pre class=\"prettyprint\">const numbers = [1, 2, 3, 4, 5];\r\nconst listItems = numbers.map((number) =&gt;\r\n&lt;li key={number.toString()}&gt;\r\n{number}\r\n&lt;\/li&gt;\r\n);\r\n<\/pre>\n<p>The best way the pick a key is to use a string that uniquely identifies a list item among its siblings and most often you would use IDs from your data as keys like the below example:<\/p>\n<pre class=\"prettyprint\">const todoItems = todos.map((todo) =&gt;\r\n&lt;li key={todo.id}&gt;\r\n{todo.text}\r\n&lt;\/li&gt;\r\n);\r\n<\/pre>\n<p>Now, when you don\u2019t have stable IDs for rendered items, you may use the item index as a key as a last resort like the below example:<\/p>\n<pre class=\"prettyprint\">const todoItems = todos.map((todo, index) =&gt;\r\n\/\/ Only do this if items have no stable IDs\r\n&lt;li key={index}&gt;\r\n{todo.text}\r\n&lt;\/li&gt;\r\n);\r\n<\/pre>\n<p>You can visit for the <a href=\"https:\/\/reactjs.org\/docs\/reconciliation.html#recursing-on-children\">explanation about why keys are necessary<\/a> if you\u2019re interested in learning more.<\/p>\n<p><strong><em>You can check our article:\u00a0<a href=\"https:\/\/www.cloudsurph.com\/adonisjs-rest-api-crud-setup\/\">AdonisJS: REST API simple CRUD Operation<\/a>. IF you want then buy a good, reliable, secure web\u00a0<a href=\"https:\/\/www.cloudsurph.com\/windows-vps-hosting\/\">hosting<\/a>\u00a0service \u00a0from here:\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">click here<\/a><\/em><\/strong><\/p>\n<h3>Extracting Components with Keys<\/h3>\n<p>The Keys only make sense in the context of the surrounding array.<\/p>\n<p>For like, if you <strong><a href=\"https:\/\/reactjs.org\/docs\/components-and-props.html#extracting-components\">extract<\/a><\/strong> a <strong>ListItem<\/strong> component, you should keep the key on the <strong>&lt;ListItem \/&gt;<\/strong> elements in the array rather than on the <strong>&lt;li&gt;<\/strong> element in the <strong>ListItem<\/strong> itself.<\/p>\n<h4><strong>Incorrect Key Usage example below:<\/strong><\/h4>\n<pre class=\"prettyprint\">function ListItem(props) {\r\n\u00a0 const value = props.value;\r\n\u00a0 return (\r\n\u00a0 \u00a0 \/\/ Wrong! There is no need to specify the key here:\r\n\u00a0 \u00a0 &lt;li key={value.toString()}&gt;\r\n\u00a0 \u00a0 \u00a0 {value}\r\n\u00a0 \u00a0 &lt;\/li&gt;\r\n\u00a0 );\r\n}\r\nfunction NumberList(props) {\r\n\u00a0 const numbers = props.numbers;\r\n\u00a0 const listItems = numbers.map((number) =&gt;\r\n\u00a0 \u00a0 \/\/ Wrong! The key should have been specified here:\r\n\u00a0 \u00a0 &lt;ListItem value={number} \/&gt;\r\n\u00a0 );\r\n\u00a0 return (\r\n\u00a0 \u00a0 &lt;ul&gt;\r\n\u00a0 \u00a0 \u00a0 {listItems}\r\n\u00a0 \u00a0 &lt;\/ul&gt;\r\n\u00a0 );\r\n}\r\n<\/pre>\n<h4><strong>Correct Key Usage example below:<\/strong><\/h4>\n<pre class=\"prettyprint\">function ListItem(props) {\r\n\u00a0 \/\/ Correct! There is no need to specify the key here:\r\n\u00a0 return &lt;li&gt;{props.value}&lt;\/li&gt;;\r\n}\r\nfunction NumberList(props) {\r\n\u00a0 const numbers = props.numbers;\r\n\u00a0 const listItems = numbers.map((number) =&gt;\r\n\u00a0 \u00a0 \/\/ Correct! Key should be specified inside the array.\r\n\u00a0 \u00a0 &lt;ListItem key={number.toString()} value={number} \/&gt;\r\n\u00a0 );\r\n\u00a0 return (\r\n\u00a0 \u00a0 &lt;ul&gt;\r\n\u00a0 \u00a0 \u00a0 {listItems}\r\n \u00a0 &lt;\/ul&gt;\r\n\u00a0 );\r\n}\r\n<\/pre>\n<h3>Keys Must Only Be Unique Among Siblings<\/h3>\n<p>Here the Keys used within arrays should be unique among their siblings.<\/p>\n<p>However, they don\u2019t need to be globally unique and we can use the same keys when we produce two different arrays like the below example:<\/p>\n<pre class=\"prettyprint\">function Blog(props) {\r\n\u00a0 const sidebar = (\r\n\u00a0 \u00a0 &lt;ul&gt;\r\n\u00a0 \u00a0 \u00a0 {props.posts.map((post) =&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;li key={post.id}&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 {post.title}\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;\/li&gt;\r\n\u00a0 \u00a0 \u00a0 )}\r\n\u00a0 \u00a0 &lt;\/ul&gt;\r\n\u00a0 );\r\n\u00a0 const content = props.posts.map((post) =&gt;\r\n\u00a0 \u00a0 &lt;div key={post.id}&gt;\r\n\u00a0 \u00a0 \u00a0 &lt;h3&gt;{post.title}&lt;\/h3&gt;\r\n\u00a0 \u00a0 \u00a0 &lt;p&gt;{post.content}&lt;\/p&gt;\r\n\u00a0 \u00a0 &lt;\/div&gt;\r\n\u00a0 );\r\n\u00a0 return (\r\n\u00a0 \u00a0 &lt;div&gt;\r\n\u00a0 \u00a0 \u00a0 {sidebar}\r\n\u00a0 \u00a0 \u00a0 &lt;hr \/&gt;\r\n\u00a0 \u00a0 \u00a0 {content}\r\n\u00a0 \u00a0 &lt;\/div&gt;\r\n\u00a0 );\r\n}\r\nconst posts = [\r\n\u00a0 {id: 1, title: 'Hello World', content: 'Welcome to learning React!'},\r\n\u00a0 {id: 2, title: 'Installation', content: 'You can install React from npm.'}\r\n];\r\n;\r\nconst root = ReactDOM.createRoot(document.getElementById('root'));\r\nroot.render(&lt;Blog posts={posts} \/&gt;);\r\n<\/pre>\n<p>So, If you need the same value in your component, it pass explicitly as a prop with a different name.<\/p>\n<p>As in the below example:<\/p>\n<pre class=\"prettyprint\">const content = posts.map((post) =&gt;\r\n&lt;Post\r\nkey={post.id}\r\nid={post.id}\r\ntitle={post.title} \/&gt;\r\n);\r\n<\/pre>\n<h3>Embedding map() in JSX<\/h3>\n<pre class=\"prettyprint\">function NumberList(props) { const numbers = props.numbers; const listItems = numbers.map((number) =&gt; &lt;ListItem key={number.toString()} value={number} \/&gt; ); return ( &lt;ul&gt; {listItems} &lt;\/ul&gt; ); }\r\n<\/pre>\n<h5>JSX allows embedding any expression in curly braces so we could inline the <strong>map()<\/strong> result:<\/h5>\n<pre class=\"prettyprint\">function NumberList(props) {\r\nconst numbers = props.numbers;\r\nreturn (\r\n&lt;ul&gt;\r\n{numbers.map((number) =&gt;\r\n&lt;ListItem key={number.toString()}\r\nvalue={number} \/&gt;\r\n)}\r\n&lt;\/ul&gt;\r\n);\r\n}\r\n<\/pre>\n<p>If you enjoyed reading this article and have more questions please reach out to our\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/submitticket.php?step=2&amp;deptid=1\">support team<\/a>\u00a0via live chat or\u00a0<a href=\"mailto:support@cloudsurph.com\">email<\/a>\u00a0and we would be glad to help you. we provide server\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">hosting<\/a>\u00a0for all types of need and we can even get your\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">server<\/a>\u00a0up and running with the service of your choice.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we can try to define ReactJS: how to use Lists and Keys, react Lists and Keys, and how can we use Lists and Keys in react. Basic List Component Usually, we would render lists inside a component. We can refactor the example of the previous article into a component that accepts an [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":5353,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[157,25,158,159,151,44,1],"tags":[54,47,105,103,48,113],"class_list":["post-5352","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos-7","category-web-hosting-virtualization","category-linux-basics","category-linux-server","category-react-js","category-kvm-xen","category-virtual-private-servers","tag-best-vps-hosting-server-maryland","tag-cheap-cloud-servers","tag-cheap-storage-server-hosting","tag-cheapest-vps","tag-dedicated-server-hosting-in-washington-d-c","tag-speed-test-vps"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>how to use Lists and Keys in ReactJS<\/title>\n<meta name=\"description\" content=\"ReactJS: how to use Lists and Keys, react Lists and Keys, and how can we use Lists and Keys in react, Lists and Keys example\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"how to use Lists and Keys in ReactJS\" \/>\n<meta property=\"og:description\" content=\"ReactJS: how to use Lists and Keys, react Lists and Keys, and how can we use Lists and Keys in react, Lists and Keys example\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloudsurph Web Hosting Washington D.C.\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/CloudSurph\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-19T14:52:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-26T13:08:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2022\/11\/how-to-use-Lists-and-Keys-in-React.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1264\" \/>\n\t<meta property=\"og:image:height\" content=\"760\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Rony\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@cloudsurph\" \/>\n<meta name=\"twitter:site\" content=\"@Cloud_Surph\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rony\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/reactjs-how-to-use-lists-and-keys-in-react\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/reactjs-how-to-use-lists-and-keys-in-react\\\/\"},\"author\":{\"name\":\"Rony\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/person\\\/ac9b4dd136d96e50d5f29c560191e7ed\"},\"headline\":\"ReactJS: How to use Lists and Keys in React\",\"datePublished\":\"2022-11-19T14:52:33+00:00\",\"dateModified\":\"2022-11-26T13:08:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/reactjs-how-to-use-lists-and-keys-in-react\\\/\"},\"wordCount\":522,\"publisher\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/reactjs-how-to-use-lists-and-keys-in-react\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/how-to-use-Lists-and-Keys-in-React.jpg\",\"keywords\":[\"Best VPS hosting server Maryland\",\"Cheap Cloud Servers\",\"Cheap Storage Server Hosting\",\"Cheapest VPS\",\"Dedicated Server Hosting in Washington D.C\",\"Speed test VPS\"],\"articleSection\":[\"CentOS 7\",\"Cloud Hosting\",\"Linux Basics\",\"Linux Server\",\"React Js\",\"Virtualization\",\"VPS Servers\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/reactjs-how-to-use-lists-and-keys-in-react\\\/\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/reactjs-how-to-use-lists-and-keys-in-react\\\/\",\"name\":\"how to use Lists and Keys in ReactJS\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/reactjs-how-to-use-lists-and-keys-in-react\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/reactjs-how-to-use-lists-and-keys-in-react\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/how-to-use-Lists-and-Keys-in-React.jpg\",\"datePublished\":\"2022-11-19T14:52:33+00:00\",\"dateModified\":\"2022-11-26T13:08:10+00:00\",\"description\":\"ReactJS: how to use Lists and Keys, react Lists and Keys, and how can we use Lists and Keys in react, Lists and Keys example\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/reactjs-how-to-use-lists-and-keys-in-react\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.cloudsurph.com\\\/reactjs-how-to-use-lists-and-keys-in-react\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/reactjs-how-to-use-lists-and-keys-in-react\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/how-to-use-Lists-and-Keys-in-React.jpg\",\"contentUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/how-to-use-Lists-and-Keys-in-React.jpg\",\"width\":1264,\"height\":760},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/reactjs-how-to-use-lists-and-keys-in-react\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.cloudsurph.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ReactJS: How to use Lists and Keys in React\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#website\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/\",\"name\":\"Cloudsurph Web Hosting Washington D.C.\",\"description\":\"Dedicated Server Hosting\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.cloudsurph.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#organization\",\"name\":\"CloudSurph Technology Solutions\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/cloudsurph-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/cloudsurph-logo.png\",\"width\":2348,\"height\":1692,\"caption\":\"CloudSurph Technology Solutions\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/CloudSurph\\\/\",\"https:\\\/\\\/x.com\\\/Cloud_Surph\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/person\\\/ac9b4dd136d96e50d5f29c560191e7ed\",\"name\":\"Rony\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g\",\"caption\":\"Rony\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/cloudsurph\"],\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/author\\\/ron\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"how to use Lists and Keys in ReactJS","description":"ReactJS: how to use Lists and Keys, react Lists and Keys, and how can we use Lists and Keys in react, Lists and Keys example","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/","og_locale":"en_US","og_type":"article","og_title":"how to use Lists and Keys in ReactJS","og_description":"ReactJS: how to use Lists and Keys, react Lists and Keys, and how can we use Lists and Keys in react, Lists and Keys example","og_url":"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/","og_site_name":"Cloudsurph Web Hosting Washington D.C.","article_publisher":"https:\/\/www.facebook.com\/CloudSurph\/","article_published_time":"2022-11-19T14:52:33+00:00","article_modified_time":"2022-11-26T13:08:10+00:00","og_image":[{"width":1264,"height":760,"url":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2022\/11\/how-to-use-Lists-and-Keys-in-React.jpg","type":"image\/jpeg"}],"author":"Rony","twitter_card":"summary_large_image","twitter_creator":"@cloudsurph","twitter_site":"@Cloud_Surph","twitter_misc":{"Written by":"Rony","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/#article","isPartOf":{"@id":"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/"},"author":{"name":"Rony","@id":"https:\/\/www.cloudsurph.com\/#\/schema\/person\/ac9b4dd136d96e50d5f29c560191e7ed"},"headline":"ReactJS: How to use Lists and Keys in React","datePublished":"2022-11-19T14:52:33+00:00","dateModified":"2022-11-26T13:08:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/"},"wordCount":522,"publisher":{"@id":"https:\/\/www.cloudsurph.com\/#organization"},"image":{"@id":"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/#primaryimage"},"thumbnailUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2022\/11\/how-to-use-Lists-and-Keys-in-React.jpg","keywords":["Best VPS hosting server Maryland","Cheap Cloud Servers","Cheap Storage Server Hosting","Cheapest VPS","Dedicated Server Hosting in Washington D.C","Speed test VPS"],"articleSection":["CentOS 7","Cloud Hosting","Linux Basics","Linux Server","React Js","Virtualization","VPS Servers"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/","url":"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/","name":"how to use Lists and Keys in ReactJS","isPartOf":{"@id":"https:\/\/www.cloudsurph.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/#primaryimage"},"image":{"@id":"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/#primaryimage"},"thumbnailUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2022\/11\/how-to-use-Lists-and-Keys-in-React.jpg","datePublished":"2022-11-19T14:52:33+00:00","dateModified":"2022-11-26T13:08:10+00:00","description":"ReactJS: how to use Lists and Keys, react Lists and Keys, and how can we use Lists and Keys in react, Lists and Keys example","breadcrumb":{"@id":"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/#primaryimage","url":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2022\/11\/how-to-use-Lists-and-Keys-in-React.jpg","contentUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2022\/11\/how-to-use-Lists-and-Keys-in-React.jpg","width":1264,"height":760},{"@type":"BreadcrumbList","@id":"https:\/\/www.cloudsurph.com\/reactjs-how-to-use-lists-and-keys-in-react\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cloudsurph.com\/"},{"@type":"ListItem","position":2,"name":"ReactJS: How to use Lists and Keys in React"}]},{"@type":"WebSite","@id":"https:\/\/www.cloudsurph.com\/#website","url":"https:\/\/www.cloudsurph.com\/","name":"Cloudsurph Web Hosting Washington D.C.","description":"Dedicated Server Hosting","publisher":{"@id":"https:\/\/www.cloudsurph.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.cloudsurph.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.cloudsurph.com\/#organization","name":"CloudSurph Technology Solutions","url":"https:\/\/www.cloudsurph.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.cloudsurph.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2016\/04\/cloudsurph-logo.png","contentUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2016\/04\/cloudsurph-logo.png","width":2348,"height":1692,"caption":"CloudSurph Technology Solutions"},"image":{"@id":"https:\/\/www.cloudsurph.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/CloudSurph\/","https:\/\/x.com\/Cloud_Surph"]},{"@type":"Person","@id":"https:\/\/www.cloudsurph.com\/#\/schema\/person\/ac9b4dd136d96e50d5f29c560191e7ed","name":"Rony","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g","caption":"Rony"},"sameAs":["https:\/\/x.com\/cloudsurph"],"url":"https:\/\/www.cloudsurph.com\/author\/ron\/"}]}},"_links":{"self":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts\/5352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/comments?post=5352"}],"version-history":[{"count":7,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts\/5352\/revisions"}],"predecessor-version":[{"id":5396,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts\/5352\/revisions\/5396"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/media\/5353"}],"wp:attachment":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/media?parent=5352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/categories?post=5352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/tags?post=5352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}