react-rendering-lists Flashcards

1
Q

When would we want to dynamically create a list of React components?

A

You will often want to display multiple similar components from a collection of data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why is it important for React components to be data-driven?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Where in the component code would a list of React components typically be built?

A

render method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What Array method is commonly used to create a list of React components?

A

map

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why do components in a list need to have unique keys?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly