Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

key being passed as prop react

/* 
The key prop has a special meaning in React. It it is not passed to the component as prop but is used by React to aid the reconciliation of collections. 
It allows React to associate the elements of the previous tree with the elements of the next tree.
It's good that you have a key (and you need one if you pass an array of elements), but if you want to pass that value along to the component, you should another prop:

*/
<FeedItem key={item.key} id={item.key} ... />
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #key #passed #prop #react
ADD COMMENT
Topic
Name
1+5 =