React - Render dynamic list of components
What worked for me:
render() {
const components = [ComponentA, ComponentB, ComponentC] // references to components
return (
<div>
{components.map((comp, i) => React.createElement(comp, { key: i })}
</div>
);
}
Had to use a reference to the component and had to use React.createElement
due to problems with nested JSX (might be Typescript related).