Context: I am developing a widget-based webapp, (like the defunct iGoogle, where users can choose which widgets they want to display). Each widget is a React component.
You could use an object as a lookup for the component type and keep the details of rendering it in one place:
var components = { 'HiWidget': HiWidget, 'HelloWidget': HelloWidget } var Component = components[dataFromObj.type] React.render( , document.getElementById('try3') )