<!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>
</head>
<body>
<div id="demoReact">
</div>
<script type="text/babel">
function MyComA(){
return (
<div>我是无状态组件1</div>
)
}
function MyComB(){
return (
<div>我是无状态组件2</div>
)
}
function MyComC(){
return (
<div>我是无状态组件3</div>
)
}
function MyComD(){
return (
<div>我是无状态组件4</div>
)
}
function Com(){
return(
<div>
<MyComA/>
<MyComB/>
<MyComC/>
<MyComD/>
</div>
)
}
let com=<Com/>
ReactDOM.render(com,document.getElementById('demoReact'))
</script>
</body>
</html>
运行结果

浙公网安备 33010602011771号