I'm trying to render an array of named react components, say <Foo />, <Bar />, and <Baz />,for example.
const rendered = [];
const getItems = this.props.itemslist.map((item, key) => {
const TYPE = item.type;
rendered.push(<TYPE data-attributes={attributes} key={key} />);
});
return (
<Grid>
<Row>
{rendered}
</Row>
</Grid>
);
I can iterate over my array and see in the console the array of elements, but they are rendered as empty html elements "<foo></foo><bar></bar><baz></baz>", and not the actual components.
Why is this happening and, more importantly, how can I get the COMPONENTS to render?
item.type. Instead store component itself.itemslist: [ { type: 'Foo', }, { type: 'Bar', }, { type: 'Baz', }, ]