CodeZettaInterview Hub

React · JSX · Fresh / Intern · Best Practice

What are the rules for the key prop in lists?

Short Interview Answer

Keys should be stable unique IDs among siblings—not random, preferably not index if list reorders.

Detailed Explanation

Keys help reconciliation. Wrong keys remount components and reset state.

Did you know this answer?