{"id":3540,"date":"2021-07-24T08:53:39","date_gmt":"2021-07-24T08:53:39","guid":{"rendered":"http:\/\/the-codest.localhost\/blog\/react-keys-yes-you-need-them-but-why-exactly\/"},"modified":"2026-04-24T11:30:22","modified_gmt":"2026-04-24T11:30:22","slug":"react-raktai-taip-ju-reikia-bet-kodel-butent-ju","status":"publish","type":"post","link":"https:\/\/thecodest.co\/lt\/blog\/react-keys-yes-you-need-them-but-why-exactly\/","title":{"rendered":"React raktai, Taip! Jums j\u0173 reikia, bet kod\u0117l?"},"content":{"rendered":"<p>Be to, reikia nepamir\u0161ti dar vieno dalyko, t. y. <strong><a href=\"https:\/\/thecodest.co\/lt\/blog\/conditional-component-visibility-in-react\/\">React<\/a> Pagrindinis<\/strong> atribut\u0105, j\u012f turi tur\u0117ti kiekvienas atvaizduojamo s\u0105ra\u0161o elementas. \u0160i s\u0105voka yra vienas i\u0161 pirm\u0173j\u0173 dalyk\u0173, kuriuos kiekvienas <a href=\"https:\/\/thecodest.co\/lt\/blog\/hire-vue-js-developers\/\">k\u016br\u0117jas<\/a> su\u017eino apie <strong>React<\/strong> kelion\u0117s prad\u017eioje. Dabar \u0161iek tiek giliau panagrin\u0117kime, kod\u0117l taip yra ir kada galime imtis trumpesni\u0173 keli\u0173.<\/p>\n<h2>Kam reikalingas \u0161is pagrindinis po\u017eymis?<\/h2>\n<p>Papras\u010diausias atsakymas \u0161iuo atveju b\u016bt\u0173 \u201coptimizuoti pakartotinius perdavimus\u201d, ta\u010diau i\u0161samesnis atsakymas tur\u0117t\u0173 bent jau pamin\u0117ti s\u0105vok\u0105 <strong>React Derinimas<\/strong>. Tai procesas, kurio metu nustatoma, kaip efektyviausiai atnaujinti vartotojo s\u0105saj\u0105. Kad tai padarytum\u0117te greitai, <strong>React<\/strong> turi nuspr\u0119sti, kurias element\u0173 med\u017eio dalis reikia atnaujinti, o kuri\u0173 ne. Ta\u010diau DOM gali b\u016bti daugyb\u0117 element\u0173, o kiekvieno j\u0173 palyginimas sprend\u017eiant, kur\u012f i\u0161 j\u0173 reikia atnaujinti, yra gana brangus. Norint tai optimizuoti, <strong>React<\/strong> \u012fgyvendina difingo algoritm\u0105, kuris grind\u017eiamas dviem prielaidomis:<\/p>\n<ol>\n<li>Dviej\u0173 skirting\u0173 tip\u0173 elementai niekada nebus vienodi, tod\u0117l juos atvaizduokite i\u0161 naujo.<\/li>\n<li>K\u016br\u0117jai gali rankiniu b\u016bdu pad\u0117ti optimizuoti \u0161\u012f proces\u0105 naudodami raktinius atributus, tod\u0117l elementus, net jei j\u0173 eili\u0161kumas pasikeit\u0117, galima grei\u010diau lokalizuoti ir palyginti.<\/li>\n<\/ol>\n<p>Remdamiesi tuo, galime daryti i\u0161vad\u0105, kad kiekvienas <strong>React raktas<\/strong> taip pat tur\u0117t\u0173 b\u016bti unikalus (element\u0173 s\u0105ra\u0161e, o ne visame pasaulyje) ir stabilus (netur\u0117t\u0173 keistis). Ta\u010diau kas gali nutikti, kai jie n\u0117ra tat?<\/p>\n<h2>Unikalumas, stabilumas ir masyvo indeksas<\/h2>\n<p>Kaip jau min\u0117jome anks\u010diau, <strong>React raktai<\/strong> tur\u0117t\u0173 b\u016bti stabilus ir unikalus. Papras\u010diausias b\u016bdas tai pasiekti - naudoti unikal\u0173 ID (pvz., i\u0161 duomen\u0173 baz\u0117s) ir perduoti j\u012f kiekvienam elementui, kai atvaizduojamas masyvas. Ta\u010diau kaip elgtis tais atvejais, kai neturime ID, vardo ar kit\u0173 unikali\u0173 identifikatori\u0173, kuriuos gal\u0117tume perduoti kiekvienam elementui? Na, jei nieko neperduosime kaip rakto, <strong>React<\/strong> pagal numatytuosius nustatymus ims dabartin\u012f masyvo indeks\u0105 (nes jis yra unikalus tame s\u0105ra\u0161e), kad j\u012f b\u016bt\u0173 galima tvarkyti <a href=\"https:\/\/thecodest.co\/lt\/blog\/why-us-companies-are-opting-for-polish-developers\/\">mus<\/a>, ta\u010diau konsol\u0117je taip pat bus pateiktas gra\u017eus klaidos prane\u0161imas:<\/p>\n<p><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/fWmP92MWlEdiEo-qINf6WxkfB9ruVrgPnGBCQQwRjm4L2ZplXm72UmL-ChyoXxMbXTuSCkhYGIstU7l6EhT8vSeOrcyuaAqqPn4eYTYp8nXKqqIX5Q72T3Eh93Dg33WWQz9ciCws0.png\" alt=\"\" \/><\/p>\n<p>Kod\u0117l taip yra? Atsakymas yra tas, kad masyvo indeksas n\u0117ra stabilus. Jei element\u0173 eili\u0161kumas pasikeis, pasikeis ir kiekvienas raktas, ir susidursime su problema. Jei <strong>React<\/strong> susiduriama su situacija, kai element\u0173 s\u0105ra\u0161o tvarka buvo pakeista, vis tiek bus bandoma juos palyginti pagal raktus, o tai rei\u0161kia, kad kiekvienas palyginimas baigsis komponento atk\u016brimu ir d\u0117l to visas s\u0105ra\u0161as bus kuriamas i\u0161 naujo. Be to, galime susidurti su kai kuriomis netik\u0117tomis problemomis, pavyzd\u017eiui, komponent\u0173 b\u016bsenos atnaujinimu elementams, pavyzd\u017eiui, nekontroliuojamiems \u012f\u0117jimams, ir kitomis stebuklingomis sunkiai i\u0161taisomomis problemomis.<\/p>\n<h2>I\u0161imtys<\/h2>\n<p>Gr\u012f\u017ekime prie masyvo indekso. Jei naudojate j\u012f kaip <strong>React raktas<\/strong> gali b\u016bti toks problemi\u0161kas, kod\u0117l <strong>React<\/strong> bus naudojama pagal numatytuosius nustatymus? Ar yra koks nors naudojimo atvejis, kai galima taip daryti? Atsakymas - taip, toks naudojimo atvejis yra statiniai s\u0105ra\u0161ai. Jei esate tikri, kad atvaizduojamo s\u0105ra\u0161o tvarka niekada nesikeis, saugu naudoti masyvo indeks\u0105, ta\u010diau nepamir\u0161kite, kad jei turite koki\u0173 nors unikali\u0173 identifikatori\u0173, vis tiek geriau juos naudoti vietoj j\u0173. Taip pat galite pasteb\u0117ti, kad perduodant indeksus kaip raktus <strong>React<\/strong> klaidos prane\u0161imas i\u0161nyksta, o tuo pat metu kai kurie i\u0161oriniai linteriai parodo klaid\u0105 arba \u012fsp\u0117jim\u0105. Taip yra d\u0117l to, kad ai\u0161kus indeks\u0173 kaip rakt\u0173 naudojimas laikomas bloga praktika ir kai kurie linteriai tai gali traktuoti kaip klaid\u0105, o <strong>React<\/strong> pati mano, kad tai yra \u201ck\u016br\u0117jai \u017eino, k\u0105 daro\u201d, tod\u0117l nedarykite to, nebent tikrai \u017einote, k\u0105 darote.  Keletas pavyzd\u017ei\u0173, kada galima gerai pasinaudoti \u0161ia i\u0161imtimi, b\u016bt\u0173 i\u0161skleid\u017eiamoji eilut\u0117 su statiniu mygtuk\u0173 s\u0105ra\u0161u arba element\u0173 s\u0105ra\u0161o rodymas su j\u016bs\u0173 \u012fmon\u0117s adreso informacija.<\/p>\n<h2>Duomen\u0173 rinkiniu pagr\u012fsto rakto alternatyva<\/h2>\n<p>Tarkime, kad n\u0117 vienas i\u0161 pirmiau i\u0161vardyt\u0173 variant\u0173 mums netinka. Pavyzd\u017eiui, turime rodyti element\u0173 s\u0105ra\u0161\u0105, sudaryt\u0105 pagal eilut\u0117s masyv\u0105, kuris gali b\u016bti dubliuojamas, bet taip pat gali b\u016bti pertvarkytas. \u0160iuo atveju negalime naudoti n\u0117 vienos i\u0161 eilu\u010di\u0173, nes jos n\u0117ra unikalios (d\u0117l to gali atsirasti ir stebukling\u0173 klaid\u0173), o masyvo indeksas n\u0117ra pakankamai geras, nes pakeisime element\u0173 tvark\u0105. Paskutinis dalykas, kuriuo galime pasikliauti tokiose situacijose, yra kai kuri\u0173 i\u0161orini\u0173 identifikatori\u0173 naudojimas. Atminkite, kad jis turi b\u016bti stabilus, tod\u0117l negalime rinktis tiesiog Math.random(). Yra keletas NPM paket\u0173, kuriuos galime naudoti tokiais atvejais, pvz. <a href=\"https:\/\/www.npmjs.com\/package\/uuid\" rel=\"nofollow\">\u201cuuid\u201d<\/a> pakuot\u0117. Tokie \u012frankiai gali pad\u0117ti i\u0161laikyti stabilius ir unikalius s\u0105ra\u0161o raktus, net jei negalime rasti tinkam\u0173 identifikatori\u0173 savo s\u0105ra\u0161e. <a href=\"https:\/\/thecodest.co\/lt\/blog\/app-data-collection-security-risks-value-and-types-explored\/\">duomenys<\/a> rinkinys. Tur\u0117tume apsvarstyti galimyb\u0119 pirmiausia naudoti duomen\u0173 baz\u0117s ID ir masyvo indeks\u0105 (jei \u012fmanoma), kad suma\u017eintume paket\u0173, naudojam\u0173 m\u016bs\u0173 <a href=\"https:\/\/thecodest.co\/lt\/dictionary\/why-do-projects-fail\/\">projektas<\/a>.<\/p>\n<h2>Apibendrinimas<\/h2>\n<ul>\n<li>Kiekvienas s\u0105ra\u0161o elementas <strong>React<\/strong> elementai tur\u0117t\u0173 tur\u0117ti unikal\u0173, stabil\u0173 rakto atribut\u0105,<\/li>\n<li><strong>React raktai<\/strong> naudojami siekiant pagreitinti <strong>Derinimo procesas<\/strong> ir i\u0161vengti nereikalingo s\u0105ra\u0161\u0173 element\u0173 atstatymo,<\/li>\n<li>Geriausias rakt\u0173 \u0161altinis yra duomen\u0173 \u012fvedimo unikalus ID (pvz., i\u0161 duomen\u0173 baz\u0117s),<\/li>\n<li>Masyvo indeks\u0105 galite naudoti kaip rakt\u0105, bet tik statiniam s\u0105ra\u0161ui, kurio tvarka nesikeis,<\/li>\n<li>Jei n\u0117ra kito b\u016bdo, kaip gauti stabilius ir unikalius raktus, apsvarstykite galimyb\u0119 naudoti i\u0161orinius ID teik\u0117jus, pavyzd\u017eiui, paket\u0105 \u201cuuid\u201d.<\/li>\n<\/ul>\n<p><article-inline-code-review><\/article-inline-code-review><\/p>\n<p><b>Skaityti daugiau:<\/b><\/p>\n<p><a href=\"https:\/\/thecodest.co\/blog\/why-you-should-probably-use-typescript\">Kod\u0117l tur\u0117tum\u0117te (tikriausiai) naudoti Typescript<\/a><\/p>\n<p><a href=\"https:\/\/thecodest.co\/blog\/how-not-to-kill-a-project-with-bad-coding-practices\/\">Kaip nesunaikinti projekto d\u0117l blogos kodavimo praktikos?<\/a><\/p>\n<p><a href=\"https:\/\/thecodest.co\/blog\/data-fetching-strategies-in-nextjs\/\">Duomen\u0173 gavimo strategijos \"NextJS<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Su React paversti masyv\u0105 element\u0173 s\u0105ra\u0161u gana paprasta, i\u0161 esm\u0117s viskas, k\u0105 reikia padaryti, tai atvaizduoti t\u0105 masyv\u0105 ir gr\u0105\u017einti tinkam\u0105 element\u0105 kiekvienam masyvo elementui.<\/p>","protected":false},"author":2,"featured_media":3541,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-3540","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-development"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>React Keys, Yes! You Need Them, but Why Exactly? - The Codest<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thecodest.co\/lt\/tinklarastis\/react-raktai-taip-ju-reikia-bet-kodel-butent-ju\/\" \/>\n<meta property=\"og:locale\" content=\"lt_LT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"React Keys, Yes! You Need Them, but Why Exactly?\" \/>\n<meta property=\"og:description\" content=\"Transforming an array into a list of elements with React is pretty straightforward, basically all you need to do is map that array and return the proper element for every array item.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thecodest.co\/lt\/tinklarastis\/react-raktai-taip-ju-reikia-bet-kodel-butent-ju\/\" \/>\n<meta property=\"og:site_name\" content=\"The Codest\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-24T08:53:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-24T11:30:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/react_keys_cover.png\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"thecodest\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"thecodest\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minut\u0117s\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/react-keys-yes-you-need-them-but-why-exactly\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/react-keys-yes-you-need-them-but-why-exactly\\\/\"},\"author\":{\"name\":\"thecodest\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\"},\"headline\":\"React Keys, Yes! You Need Them, but Why Exactly?\",\"datePublished\":\"2021-07-24T08:53:39+00:00\",\"dateModified\":\"2026-04-24T11:30:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/react-keys-yes-you-need-them-but-why-exactly\\\/\"},\"wordCount\":988,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/react-keys-yes-you-need-them-but-why-exactly\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/react_keys_cover.png\",\"articleSection\":[\"Software Development\"],\"inLanguage\":\"lt-LT\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/react-keys-yes-you-need-them-but-why-exactly\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/react-keys-yes-you-need-them-but-why-exactly\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/react-keys-yes-you-need-them-but-why-exactly\\\/\",\"name\":\"React Keys, Yes! You Need Them, but Why Exactly? - The Codest\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/react-keys-yes-you-need-them-but-why-exactly\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/react-keys-yes-you-need-them-but-why-exactly\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/react_keys_cover.png\",\"datePublished\":\"2021-07-24T08:53:39+00:00\",\"dateModified\":\"2026-04-24T11:30:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/react-keys-yes-you-need-them-but-why-exactly\\\/#breadcrumb\"},\"inLanguage\":\"lt-LT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/react-keys-yes-you-need-them-but-why-exactly\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"lt-LT\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/react-keys-yes-you-need-them-but-why-exactly\\\/#primaryimage\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/react_keys_cover.png\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/react_keys_cover.png\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/react-keys-yes-you-need-them-but-why-exactly\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thecodest.co\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"React Keys, Yes! You Need Them, but Why Exactly?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"name\":\"The Codest\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thecodest.co\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"lt-LT\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\",\"name\":\"The Codest\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"lt-LT\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"width\":144,\"height\":36,\"caption\":\"The Codest\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/pl.linkedin.com\\\/company\\\/codest\",\"https:\\\/\\\/clutch.co\\\/profile\\\/codest\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\",\"name\":\"thecodest\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"lt-LT\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"caption\":\"thecodest\"},\"url\":\"https:\\\/\\\/thecodest.co\\\/lt\\\/author\\\/thecodest\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"React raktai, Taip! Jums j\u0173 reikia, bet kod\u0117l? - The Codest","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:\/\/thecodest.co\/lt\/tinklarastis\/react-raktai-taip-ju-reikia-bet-kodel-butent-ju\/","og_locale":"lt_LT","og_type":"article","og_title":"React Keys, Yes! You Need Them, but Why Exactly?","og_description":"Transforming an array into a list of elements with React is pretty straightforward, basically all you need to do is map that array and return the proper element for every array item.","og_url":"https:\/\/thecodest.co\/lt\/tinklarastis\/react-raktai-taip-ju-reikia-bet-kodel-butent-ju\/","og_site_name":"The Codest","article_published_time":"2021-07-24T08:53:39+00:00","article_modified_time":"2026-04-24T11:30:22+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/react_keys_cover.png","type":"image\/png"}],"author":"thecodest","twitter_card":"summary_large_image","twitter_misc":{"Written by":"thecodest","Est. reading time":"5 minut\u0117s"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thecodest.co\/blog\/react-keys-yes-you-need-them-but-why-exactly\/#article","isPartOf":{"@id":"https:\/\/thecodest.co\/blog\/react-keys-yes-you-need-them-but-why-exactly\/"},"author":{"name":"thecodest","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76"},"headline":"React Keys, Yes! You Need Them, but Why Exactly?","datePublished":"2021-07-24T08:53:39+00:00","dateModified":"2026-04-24T11:30:22+00:00","mainEntityOfPage":{"@id":"https:\/\/thecodest.co\/blog\/react-keys-yes-you-need-them-but-why-exactly\/"},"wordCount":988,"commentCount":0,"publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"image":{"@id":"https:\/\/thecodest.co\/blog\/react-keys-yes-you-need-them-but-why-exactly\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/react_keys_cover.png","articleSection":["Software Development"],"inLanguage":"lt-LT","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thecodest.co\/blog\/react-keys-yes-you-need-them-but-why-exactly\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thecodest.co\/blog\/react-keys-yes-you-need-them-but-why-exactly\/","url":"https:\/\/thecodest.co\/blog\/react-keys-yes-you-need-them-but-why-exactly\/","name":"React raktai, Taip! Jums j\u0173 reikia, bet kod\u0117l? - The Codest","isPartOf":{"@id":"https:\/\/thecodest.co\/#website"},"primaryImageOfPage":{"@id":"https:\/\/thecodest.co\/blog\/react-keys-yes-you-need-them-but-why-exactly\/#primaryimage"},"image":{"@id":"https:\/\/thecodest.co\/blog\/react-keys-yes-you-need-them-but-why-exactly\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/react_keys_cover.png","datePublished":"2021-07-24T08:53:39+00:00","dateModified":"2026-04-24T11:30:22+00:00","breadcrumb":{"@id":"https:\/\/thecodest.co\/blog\/react-keys-yes-you-need-them-but-why-exactly\/#breadcrumb"},"inLanguage":"lt-LT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thecodest.co\/blog\/react-keys-yes-you-need-them-but-why-exactly\/"]}]},{"@type":"ImageObject","inLanguage":"lt-LT","@id":"https:\/\/thecodest.co\/blog\/react-keys-yes-you-need-them-but-why-exactly\/#primaryimage","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/react_keys_cover.png","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/react_keys_cover.png","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/thecodest.co\/blog\/react-keys-yes-you-need-them-but-why-exactly\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thecodest.co\/"},{"@type":"ListItem","position":2,"name":"React Keys, Yes! You Need Them, but Why Exactly?"}]},{"@type":"WebSite","@id":"https:\/\/thecodest.co\/#website","url":"https:\/\/thecodest.co\/","name":"The Codest","description":"","publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thecodest.co\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"lt-LT"},{"@type":"Organization","@id":"https:\/\/thecodest.co\/#organization","name":"The Codest","url":"https:\/\/thecodest.co\/","logo":{"@type":"ImageObject","inLanguage":"lt-LT","@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","width":144,"height":36,"caption":"The Codest"},"image":{"@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/pl.linkedin.com\/company\/codest","https:\/\/clutch.co\/profile\/codest"]},{"@type":"Person","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76","name":"thecodest","image":{"@type":"ImageObject","inLanguage":"lt-LT","@id":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","caption":"thecodest"},"url":"https:\/\/thecodest.co\/lt\/author\/thecodest\/"}]}},"_links":{"self":[{"href":"https:\/\/thecodest.co\/lt\/wp-json\/wp\/v2\/posts\/3540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecodest.co\/lt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecodest.co\/lt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecodest.co\/lt\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thecodest.co\/lt\/wp-json\/wp\/v2\/comments?post=3540"}],"version-history":[{"count":5,"href":"https:\/\/thecodest.co\/lt\/wp-json\/wp\/v2\/posts\/3540\/revisions"}],"predecessor-version":[{"id":7970,"href":"https:\/\/thecodest.co\/lt\/wp-json\/wp\/v2\/posts\/3540\/revisions\/7970"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecodest.co\/lt\/wp-json\/wp\/v2\/media\/3541"}],"wp:attachment":[{"href":"https:\/\/thecodest.co\/lt\/wp-json\/wp\/v2\/media?parent=3540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecodest.co\/lt\/wp-json\/wp\/v2\/categories?post=3540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecodest.co\/lt\/wp-json\/wp\/v2\/tags?post=3540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}