Which of the following best defines the “key” prop?

Q & ACategory: React JSWhich of the following best defines the “key” prop?
Admin Staff asked 2 years ago

Which of the following best defines the “key” prop?

a) “Key” prop is used to look pretty, and there is no benefit whatsoever.

b) “Key” prop is a way for React to identify a newly added item in a list and compare it during the “diffing” algorithm.

c) It is one of the attributes in HTML.

d) It is NOT commonly used in an array.

1 Answers
Admin Staff answered 2 years ago

b) “Key” prop is a way for React to identify a newly added item in a list and compare it during the “diffing” algorithm.