I have a question about using react. As you can see from the title, I\'m wondering if it is possible to use React component(that is created by React.createClass) inside of \
dangerouslySetInnerHTML expects a JS object with __html property which should be valid HTML markup. Instead you are providing there and expecting it to render that component's html. React won't process there. dangerouslySetInnerHTML as name suggests should be avoided. Moreover what you are trying to accomplish here can easily be done through React only.
const MySubComponent = React.createClass({
render() {
return (MySubComponent {this.props.index}
);
}
});
const MyComponent = React.createClass({
render() {
let subComponentList = [];
[1,2,3,4,5].forEach(function(i){
subComponentList.push( );
});
return (
{subComponentList}
);
}
});
ReactDOM.render( , mountNode);