Why you should NEVER use index as key in React Lists

  Рет қаралды 1,367

Code with Ahsan

Code with Ahsan

Жыл бұрын

In this video, I'm gonna tell you why you should never use index as the key. in React Lists.
You may have heard about it already from other developers that it is not recommended to use the index (or indices) of the item in the array as the key prop when looping over an Array to render a list of items. But if you do it, you'll see that there is literally no issue in doing so. But then...why is it not recommended? Let me show you with an example of why it is bad to use indices as keys in a React app.
Code Repo:
github.com/code-with-ahsan/re...
✨FREE APIs to use for your passion projects ✨
codewithahsan.dev/rapidapi
⭐ Sign up for updates on my Full Stack Developer Course: codewithahsan.dev
⭐ New to code and none of this is making sense? Watch my '5+ KZfaq Coding Bootcamp' in which you will learn HTML, CSS, and JavaScript Fundamentals completely from scratch. It's at codewithahsan.dev/web-dev-boo... and it's 100% free.
⭐ If you would like to buy me a coffee, well thank you very much that is super cool! : buymeacoffee.com/codewithahsan
You can also find me on:
Twitter: / codewith_ahsan
Instagram: / codewithahsan
GitHub: github.com/ahsanayaz
Facebook: / codewithahsan

Пікірлер: 13
@FaiyazMohd145
@FaiyazMohd145 7 ай бұрын
Superbly explained
@CodeWithAhsan
@CodeWithAhsan 7 ай бұрын
Thank you
@akashsarki6406
@akashsarki6406 8 ай бұрын
Thanks fo making this.
@CodeWithAhsan
@CodeWithAhsan 8 ай бұрын
Glad it helped
@naseeriyat9241
@naseeriyat9241 Жыл бұрын
Thanks for the video
@abubakar-emumba
@abubakar-emumba Жыл бұрын
Thanks Ahsan bhai
@CodeWithAhsan
@CodeWithAhsan Жыл бұрын
You are welcome! Do share the video :)
@usamahassankhan5270
@usamahassankhan5270 Жыл бұрын
Amazing
@CodeWithAhsan
@CodeWithAhsan Жыл бұрын
Thanks :) Do share the video
@js-swift
@js-swift Жыл бұрын
Sir can you just make a roadmap on reactjs because when React18 came out things changed even now people started using function component instead of class component Please sir and thank for this video
@CodeWithAhsan
@CodeWithAhsan Жыл бұрын
Sure. I’ll work on it
@criccric544
@criccric544 Жыл бұрын
First. ❤️🤩
@CodeWithAhsan
@CodeWithAhsan Жыл бұрын
Let’s go !!! 🙌🏽
8 Design Patterns | Prime Reacts
22:10
ThePrimeTime
Рет қаралды 388 М.
8 TypeScript Tips To Expand Your Mind (and improve your code)
10:54
Children deceived dad #comedy
00:19
yuzvikii_family
Рет қаралды 6 МЛН
Получилось у Вики?😂 #хабибка
00:14
ХАБИБ
Рет қаралды 6 МЛН
The Key to Understanding React: Why Keys Matter
6:50
Coding With Chaim
Рет қаралды 8 М.
DONT USE AN ORM | Prime Reacts
25:46
ThePrimeTime
Рет қаралды 200 М.
Why do We Need Keys in React?
7:47
Mehul - Codedamn
Рет қаралды 10 М.
The Hidden Cost Of GraphQL And NodeJS
28:35
ThePrimeTime
Рет қаралды 184 М.
React index as key | Don't use index as a key
5:27
Weibenfalk
Рет қаралды 3,3 М.
React Keys and Lists - Complete Tutorial!
9:51
Cosden Solutions
Рет қаралды 6 М.
This is why you need the key property in React
5:44
Web Dev Cody
Рет қаралды 16 М.
Understanding React's UI Rendering Process
29:07
CrossComm, Inc.
Рет қаралды 207 М.
APPLE совершила РЕВОЛЮЦИЮ!
0:39
ÉЖИ АКСЁНОВ
Рет қаралды 4,3 МЛН
SSD с кулером и скоростью 1 ГБ/с
0:47
Rozetked
Рет қаралды 657 М.