0
What is the purpose of the key prop in React?
subina kallyani
easy
0completed
0
Answer
The key prop is used by React to identify elements in a list and track them efficiently during re-rendering.
It helps React understand which items have changed, been added, or removed.
Why key is important:
When rendering lists, React compares the old and new lists.
The key helps React match each item with its previous version, improving performance and correctness.
Click to Reveal Answer
Tap anywhere to see the solution
Revealed
Comments0