Uncaught Error: Invariant Violation: Objects are not valid as a React child (found: object with keys {child}). If you meant to render a collection of children, use an array instead or wrap the object using createFragment(object) from the React add-ons. Check the render method of
Matchs
.
请问报这个错误是什么原因啊?代码如下:
var Matchs = React.createClass({
render: function() {
return (
<div className="matchs">
{React.Children.map(this.props.children, function (child) {
return {child};
})}
</div>
);
}
});
var MainWindow = React.createClass({
render: function() {
return (
<div className="MainWindow">
<Matchs>
{this.props.data.match.map(function (match_, index_) {
return <Match data={match_} />;
})}
</Matchs>
</div>
);
}
});