← BYTES
React.js·Starter·Ref: 4.1.5
What is the purpose of the `key` prop when rendering a list of elements?
Have a question about this video? Mention reference 4.1.5 when you contact us.
a.It sets the CSS `z-index` of each list item
b.It gives React a stable identity for each item so it can correctly match items across re-renders
c.It determines the alphabetical sort order of the list
d.It is purely decorative and has no effect on behavior
`key` tells React which array entries correspond to which rendered elements across renders, so it can correctly preserve, reorder, or remove the right DOM nodes and component state instead of guessing by position.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES415#Reactjs