Recall & Review
beginner
What is the purpose of keys in React lists?
Keys help React identify which items have changed, been added, or removed. They make updates faster and keep UI consistent.
Click to reveal answer
beginner
Why should keys be unique among siblings in a list?
Unique keys prevent React from mixing up elements. If keys repeat, React may reuse wrong elements causing bugs.
Click to reveal answer
intermediate
Is using array index as a key always a good idea? Why or why not?
Using index as key is okay only if list items never change order or get removed. Otherwise, it can cause wrong UI updates.
Click to reveal answer
beginner
What happens if you forget to add keys to list items in React?
React will warn you in the console. Without keys, React can't track items well, leading to slower updates and possible UI glitches.
Click to reveal answer
intermediate
How do keys affect React's reconciliation process?
Keys let React match old and new elements during reconciliation. This helps React update only changed parts efficiently.Click to reveal answer
What should a key in a React list be?
✗ Incorrect
Keys must be unique among siblings to help React track elements correctly.
What is a risk of using array index as a key when list items change order?
✗ Incorrect
Using index as key when items reorder can confuse React, leading to wrong UI updates.
If you forget keys in a list, what will React do?
✗ Incorrect
React warns you in the console if keys are missing in lists.
Keys help React to:
✗ Incorrect
Keys help React identify changed, added, or removed items for efficient updates.
Which of these is a good choice for a key?
✗ Incorrect
Stable unique IDs like user IDs are best keys to keep UI consistent.
Explain why keys are important in React lists and what can go wrong if keys are missing or not unique.
Think about how React updates list items efficiently.
You got /4 concepts.
Describe when it is okay and not okay to use array index as a key in React lists.
Consider what happens when list items move around.
You got /3 concepts.