React Rendering Dynamic Inner Components
This example illustrates what i`m tryng to do. The goal is to have a dynamic component array and render it o the screen. I`m not being able to do the rendering part. import PropT
Solution 1:
In order to create dynamic component, you could just do the following
constructor() {
super();
this.components = [MyComponent1, MyComponent2];
}
render() {
return (
<divclassName='modal-contents'>
{this.components.map(function (Component, i) {
return <Componentkey= {i } />
})}
</div>
)
}
Post a Comment for "React Rendering Dynamic Inner Components"