Closed golestanirad closed 3 years ago
It's only bad practice if the order of the items can change, in our case the order of the items never changes so it's fine.
If you have further follow-up questions you can bring it to office hours
It's only bad practice if the order of the items can change, in our case the order of the items never changes so it's fine.
If you have further follow-up questions you can bring it to office hours
Thanks, good to know! But it was nice if it was mentioned in the tutorial, as someone like me may don't know that, and then may start using the index as the key! because we are students and learn things from you!
Good point!
Hi there 👋 In here https://epicreact.dev/modules/react-hooks/usestate-tic-tac-toe-extra-credit-solution-3 you used the index in the map loop as the key for each
li
which I guess is considered a very bad and dangerous practice, could you tell us why did you go that way? I'm 100% sure that you are aware of that issue so thought might be something new in React that I'm not aware of.We don’t recommend using indexes for keys if the order of items may change ...
https://reactjs.org/docs/lists-and-keys.html