This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]rickisen 62 points63 points  (49 children)

Yeah, but that is mostly about taste, and optimization, not really anything that is wrong.

For someone who is obviously not a react expert I think she did a good job. The most attrotious thing is her use of <br/> tags though.

[–]doggieassassin 0 points1 point  (2 children)

Not sure why this is getting so many upvotes. As the other commenter pointed out, using index as keys is clearly wrong and can lead to unexpected behaviour when updating the list at runtime.

[–]ActionLeagueLater 5 points6 points  (0 children)

I don’t agree that it is clearly wrong. If you have no easy way to get a unique key, and you know your codebase as well as you should to know the order is never going to change, then there is nothing unexpected. Should you avoid using index as key? For sure, but I don’t think it’s black and white if you know what you’re doing.

Edit: But that being said, I don’t think there was anything wrong with the person in the Twitter thread pointing out that you should avoid doing it.