写了一个mixin方法:
var React = require('react'); module.exports = { // 将属性传递给子级 // Element: 子级类型, propsMap: 属性对象 propsToChildren: function (Element, propsMap) { return React.Children.map(this.props.children,function(child) { if (child.type === Element) { return React.cloneElement(child, propsMap) } else { return child; } }, this); } }