React | Lists and Keys | Question 7

Last Updated :
Discuss
Comments

Which of the following is the correct syntax for rendering a list of components with unique keys in React?

{list.map(item => <Component key={item.id} />)}

{list.map(<Component key={item.id} />)}

{list.map(Component => <key={item.id} />)}

{list.map(<key={item.id}>Component</key>)}

Share your thoughts in the comments