In a component tree, all sub components are passed to the parent component in a prop called
children. We can access those children within a component, and change what the component is rendering based on the children.
We'll use children as a way to pass text labels to a new
FilterBar component - and map over those children to create new filter bar labels, instead of hard coding those values in the component.
Summary of Content:
- Make a new
FilterBarstateless functional component
- Pass text labels and children to the
- Map over the children in
FilterBarto return a button for each filter option
- Use React.Children to map over the children, in order to protect against zero or one children