React的slot插槽
1 <script type="text/babel"> 2 class Abox extends React.Component{ 3 constructor(props) { 4 super(props); 5 6 } 7 render() { 8 return ( 9 <div className="box1"> 10 { 11 this.props.children 12 } 13 </div> 14 ) 15 } 16 } 17 18 ReactDOM.render( 19 <div className="box1"> 20 <Abox> 21 <p>11</p> 22 <p>22</p> 23 </Abox> 24 </div>, 25 document.getElementById("root") 26 ) 27 </script>