类似vue的函数插槽

 1 <script type="text/babel">
 2 
 3     function Son(props){
 4         return (
 5             <div>
 6                 {
 7                     props.children
 8                 }
 9             </div>
10         )
11     }
12     function Abox(){
13         return (
14             <Son>
15               <p>11111</p>
16             </Son>
17         )
18     }
19 
20 
21     ReactDOM.render(
22         <div className="box1">
23             <Abox></Abox>
24         </div>,
25         document.getElementById("root")
26     )
27 </script>
posted @ 2019-12-30 11:35  帅气的骑士  阅读(141)  评论(0编辑  收藏  举报