React 中的 this.props.children 用法
作者:
wlianfu | 来源:发表于
2016-11-30 13:24 被阅读1515次class RootContent extends React.Component{
constructor(props){
super(props);
}
render(){
return (
<div className='divider'>
{this.props.children}
</div>
);
}
}
class RootChild extends React.Component{
constructor(props){
super(props);
}
render(){
return (
<RootContent>
<p>Hello, React</p>
<p>Hello, Redux</p>
<p>Hello, Facebook</p>
<p>Hello, Google</p>
</RootContent>
);
}
}
ReactDOM.render(
<RootChild />,
document.querySelector('#root')
);
本文标题:React 中的 this.props.children 用法
本文链接:https://www.haomeiwen.com/subject/tectmttx.html
网友评论