Recall & Review
beginner
What is the main purpose of keys in React lists?
Keys help React identify which items have changed, been added, or removed. This makes updating the UI faster and more efficient.
Click to reveal answer
beginner
Why should keys be unique among siblings in a list?
Unique keys prevent confusion when React compares elements. If keys are not unique, React might update the wrong item, causing bugs.
Click to reveal answer
intermediate
What can happen if you use the array index as a key in React?
Using array index as a key can cause problems when the list changes order or items are added/removed. React may reuse elements incorrectly, leading to UI bugs.
Click to reveal answer
beginner
How do keys improve React's rendering performance?
Keys let React quickly find which elements changed without re-rendering the entire list. This reduces work and speeds up updates.Click to reveal answer
intermediate
Can two different lists share the same keys for their items?
Yes, keys only need to be unique among siblings in the same list. Different lists can reuse keys without issues.
Click to reveal answer
Why does React require keys for list items?
✗ Incorrect
Keys help React identify changes in lists so it can update only what is needed.
What is a bad practice when assigning keys in React?
✗ Incorrect
Using array index as key can cause bugs if the list order changes or items are added/removed.
Keys must be unique among which elements?
✗ Incorrect
Keys only need to be unique among siblings in the same list.
What happens if keys are missing in a React list?
✗ Incorrect
Without keys, React can't track items well, leading to inefficient updates and possible UI bugs.
Can two different lists use the same keys for their items?
✗ Incorrect
Keys must be unique only among siblings in the same list, so different lists can reuse keys.
Explain why keys are important in React lists and what problems they help avoid.
Think about how React updates the screen when list items change.
You got /4 concepts.
Describe the risks of using array index as a key in React and when it might cause bugs.
Consider what happens if you reorder or add items in a list.
You got /4 concepts.