react-rendering-lists Flashcards
When would we want to dynamically create a list of React components?
You will often want to display multiple similar components from a collection of data.
Why is it important for React components to be data-driven?
The only difference among those list items is their contents, their data. You will often need to show several instances of the same component using different data when building interfaces: from lists of comments to galleries of profile images.
Where in the component code would a list of React components typically be built?
render method
What Array method is commonly used to create a list of React components?
map
Why do components in a list need to have unique keys?
File names in a folder and JSX keys in an array serve a similar purpose. They let us uniquely identify an item between its siblings. A well-chosen key provides more information than the position within the array. Even if the position changes due to reordering, the key lets React identify the item throughout its lifetime.