Children Prop

Learn to use the children prop while creating page and page title components.

The children prop is a magical prop that all React components automatically have. It can be used to render child elements. It’s magical because it’s automatically there, without us having to do anything, as well as being extremely powerful.

Steps to implement children prop

In the following steps, we’ll use the children prop when creating Page and PageTitle components:

  1. First, let’s create a file called PageTitle.tsx in the src folder with the following content:

Get hands-on with 1400+ tech skills courses.