in ReactJS by
edited by
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 Answer

0 votes
by

B is the correct answer. It is used to identify any new item in a list when re-rendering. It improves performance and efficiency also.

...