A list element's key is a random value or the time, which differs on every render

tx0/ts:random-keydefaultwarningreliability/collectionsdepth fastbug

What it finds

React matches list elements between renders by their key. A key from Math.random(), a fresh UUID or the current time is new on every render, so React throws away every element and its state and creates them again.

Reported are key attributes whose value calls Math.random, Date.now, crypto.randomUUID, uuid, uuidv4, nanoid or v4, or creates a Date.

From the rule's source, random_key.rs.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:random-key" = "off"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/ts:random-key] reason="..."

tx0 explain tx0/ts:random-key shows the same in the terminal. Found a false positive? Report it.