Good article, you could also use a package like uuid() (npmjs.com/package/uuid) to generate a random unique key for you. This way you also avoid re-rendering if your amount of rows changes in this case, but it will create another dependency
That's a dangerous pattern to follow. I've been down that path, years ago. At worst, it can spawn some nasty bugs. At best, it's needlessly inefficient.
That is interesting, I think that in your example he is generating the unique key inside the map function, which will cause re-generating the keys for every re-render. If you put the unique key outside the loop function, e.g. as an object property, it should be fine:
Good article, you could also use a package like uuid() (npmjs.com/package/uuid) to generate a random unique key for you. This way you also avoid re-rendering if your amount of rows changes in this case, but it will create another dependency
Solution can work, but same it will add dependency. But i think if we have any value unique in our array itself then we should just use it as key.
That's a dangerous pattern to follow. I've been down that path, years ago. At worst, it can spawn some nasty bugs. At best, it's needlessly inefficient.
stackoverflow.com/questions/513719...
That is interesting, I think that in your example he is generating the unique key inside the map function, which will cause re-generating the keys for every re-render. If you put the unique key outside the loop function, e.g. as an object property, it should be fine:
medium.com/@robinpokorny/index-as-...