React interview questions
Show answer
Keys let React match items between renders so it can keep the right component state and DOM nodes when items are added, removed or re-ordered. Use a stable unique id from your data. Array indexes break when the order changes — state (like an input's text) can end up on the wrong row.