title: get components by string names in ReactJS
body: <p>I have a component that has some other components imported in for example:</p>
  
  <pre><code>import ComponentA from './components/ComponentA.js';
  import ComponentB from './components/ComponentB.js';
  import ComponentC from './components/ComponentC.js';
  class Main extends Component {
  ...
  </code></pre>
  
  <p>then I have a function inside the main component named <code>returnChild(String childName)</code> that gets a string input, for example <code>ComponentA</code> or <code>ComponentB</code>, and returns the Component Object.</p>
  
  <p>now I'm using a switch case to do it but components are too many and my source is messy. is there any way to get the value by string name in reactJS? For example:</p>
  
  <pre><code>returnChild = (childName) =&gt; {
      return get_value_by_name(childName)
  } 
  </code></pre>