React的slot插槽

<script type="text/babel">
     class Abox extends React.Component{
       constructor(props) {
        super(props);
         
     }
     render() {
        return (
             <div className="box1">
                 {
                     this.props.children
                }
            </div>
        )
    }
  }
 
     ReactDOM.render(
        <div className="box1">
           <Abox>
               <p>11</p>
               <p>22</p>
             </Abox>
         </div>,
         document.getElementById("root")
    )
 </script>

 

posted on 2020-10-18 11:52  漫思  阅读(2462)  评论(0编辑  收藏  举报

导航