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>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM