<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./node_modules/react/umd/react.development.js"></script>
    <script src="./node_modules/react-dom/umd/react-dom.development.js"></script>
    <script src="./node_modules/babel-standalone/babel.min.js"></script>
    <script src="./node_modules/prop-types/prop-types.js"></script>
</head>
<body>
<div id="demoReact">

</div>
<script type="text/babel">
    let bool=true
    let MyCom=(props)=>{
        return(

            <div style={{display:bool?"block":"none"}}>{
                props.arr.map((v,i)=>{
                    return <p>{v}</p>
                })
            }</div>
        )
    }
let dataarr=["爸爸","儿子","小明"]
    let Com=()=>{
        return(
            <div>
                <h1 onClick={()=>{bool=!bool;console.log(bool);fun();}}>家庭结构展示</h1>
            <MyCom arr={dataarr}></MyCom>
            </div>
        )
    }
function fun(){
    ReactDOM.render(<Com />,document.getElementById('demoReact'))
}
fun();


</script>
</body>
</html>

运行结果