Theo's Typesafe CultTTC
Theo's Typesafe Cult9mo ago
8 replies
filyys

Keys

Is key={crypto.randomUUID()} an okay-ish way of setting keys in TSX/JSX maps? I won't be needing the key for anything later but I'm not sure if this is a good way of going by it
Solution
you want to ensure that your key is something that is the same for the same state and different for all other states, a uuid is perfectly fine for this but it should not be randomly generated on the fly
Was this page helpful?