I have a generic component which maps its child components to filter only children of a certain type, as found below.
However, using the property type w
The kind of api you're making is frail and confusing. You shouldn't treat elements as data. If you need to filter, pass data to the component.
},
{type: 'Bar', element: },
{type: 'Bar', element: I'm lying but it doesn't matter},
]} />
var Main = React.createClass({
render: function(){
var filteredChildren = this.props.things.map(function(thing){
return thing.type === 'Foo' ? thing.element : false;
});
return {filteredChildren};
}
});