I must create unique keys for certain objects I create (needed for React key prop), where key can be any random string or number, but has to be truly unique for each time it's generated in program lifetime.
I tried to use new Date().getTime()
as key, but encountered problem where multiple objects got assigned the same key when creating them in loop.
Is there a function which returns something purely unique each call as long as the program is running, or do I have to implement my own counter?