React Cookbook
上QQ阅读APP看书,第一时间看更新

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.