Last week I found out why we shouldn't use the index as key. for example if index 0 is deleted, all the keys change their value as the index shifts(1 becomes 0, 2 becomes 1, etc.) Then ALL are re-rendered instead of just the updated or deleted one. The reason your code works without a key, is React will use the index itself, with a warning. I find it really useful to know why things work or don't work, and it helps in memorisation.
good video. i understand that there should be uniqueness to the elements in the json array, but it's not very clear to me why there isn't an error when you create the joke component dynamically, as it looks like it only accepts joke and rating as arguments. i'm guessing it's something in vanilla javascript with how a function accepts arguments, but it's not very intuitive.
what if i am render a table instead of the joke component for me its getting page unresponsive if i render 30 tables inside that different rows and columns
Last week I found out why we shouldn't use the index as key.
for example if index 0 is deleted, all the keys change their value as the index shifts(1 becomes 0, 2 becomes 1, etc.)
Then ALL are re-rendered instead of just the updated or deleted one.
The reason your code works without a key, is React will use the index itself, with a warning. I find it really useful to know why things work or don't work, and it helps in memorisation.
May I know where you find this?
@@shinobi1975 Cannot remember sorry.
So many key React concepts explained along the way. Thanks, Sam
PS You have a great teaching style.
{2023-06-07}
You taught this concept in 8 mins that my teacher couldn't do in 90 mins. Cheers
Great videos mate learning alot from you!
Thank you
Great Tutorial,so happy I found your channel
Very nice thanks Sam
You deserve more fame
good video. i understand that there should be uniqueness to the elements in the json array, but it's not very clear to me why there isn't an error when you create the joke component dynamically, as it looks like it only accepts joke and rating as arguments. i'm guessing it's something in vanilla javascript with how a function accepts arguments, but it's not very intuitive.
Greate job, same as always👍
great video
Thanks!
what if i am render a table instead of the joke component for me its getting page unresponsive if i render 30 tables inside that different rows and columns
How did you make the like button glow like that, when you said to press it? Never seen that before, cool.