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