Passing props to a component and validating them with PropTypes

So far, you are getting familiar with React components, but there is more to it than rendering static HTML. Like any application, we need to be able to send information (via props) to different elements. In this recipe, we are going to create new components: HeaderContent, and Footer (we will group these components into a folder called layout), and we will send some props (as attributes and as children) and validate them with PropTypes.

Get React Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.