background description: if you want to nest components through children, how to get props
I know to change the following map, but I haven"t learned it yet and I don"t know how to change it. I also know that writing HomeHeader into HomePage components can solve the problem, but I hope it can be more elegant, nested in children, and look more comfortable in index.
question: how does HomeHeader get the props.config in HomePage
the code is as follows
//
<HomePage>
<HomeHeader />
</HomePage>
//
// HomePage
static defaultProps = {
config: "aaa"
}
<div>
{React.Children.map(children, child => {
return child
})}
</div>
//
// HomeHeader
<div>
header
</div>