<script type="text/babel">
<!-- this.props.children表示读取组件的所有子节点-->
var Zu=React.createClass({
render:function(){
return (
<ol>
{
React.Children.map(this.props.children,function(children){
return <li>{children}</li>;
})
}
</ol>
);
}
});
ReactDOM.render(
<Zu>
<span>AAAA</span>
<span>CCCCC</span>
</Zu>,
document.body
);
</script>
结果:1.AAAA
2.CCCCC