I have three components that make up a fourth I want to call Search
.
<SearchContainer>
{this.props.withFilter ? <SearchFilter>Filter Orders </SearchFilter> : null}
<SearchBox withFilter={this.props.withFilter}'/>
</SearchContainer>
However, the SearchBox
component takes a couple of props itself.
{
action: React.PropTypes.string,
name: React.PropTypes.string,
method: React.PropTypes.string,
placeholder: React.PropTypes.string,
withFilter: React.PropTypes.boolean
}
I want to be able to call the Search
component and be able to pass a whole bunch of props to SearchBox
without having to add each attribute into Search
. Is there a way for a child to inherit props of the parent?
Ideally I can pass props to Search
and SearchBox
can access them without me explicitly having to write each attribute.
<Search placeholder='Hi'>