Problem is the following:
I have data in form of a list of a few thousand elements. Some of them are duplicates, and there might be the chance of having duplicate ke
I think its not correct to give Math.random() for components keys, reason is when you generate random number it is not guaranteed not to get same number again. It is very much possible that same random number is generated again while rendering component, So that time it will fail.
Some people will argue that if random number range is more it is very less probable that number will not be generated again. Yes correct but you code can generate warning any time.
One of the quick way is to use new Date() which will be unique.