Set component's props dynamically : <p>I need to set component's props after it is stored in a variable, here is pseudo code:</p>

<pre><code>render(){

    let items = [{title:'hello'}, {title:'world'}];
    let component = false;

    switch (id) {
      case 1:
        component = &lt;A /&gt;
        break;
      case 2:
        component = &lt;B /&gt;
        break;      
    }

    return(
      items.map((item, index)=&gt;{
        return(
          &lt;span&gt;
            {/* SOMETHING LIKE THIS WOULD BE COOL - IS THAT EVEN POSSIBLE*/}
            {component.props.set('title', item.title)}
          &lt;/span&gt;11

        )
      })
    )
  }
</code></pre>

<p>Inside <code>return</code> I run a loop where I need to set props for the component that is stored inside a variable.... How to set props for this component which I stored earlier in a variable? </p>
