Sign in Go Pro

Advanced React Native

Use Child Components in a Parent Component

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next



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 FilterBar stateless functional component
  • Pass text labels and children to the FilterBar.
  • Map over the children in FilterBar to return a button for each filter option
  • Use React.Children to map over the children, in order to protect against zero or one children




There are no comments on this lesson, start the conversation below ...

You need to go PRO to post comments.

Lessons in Advanced React Native