How to clone multiple children with React.cloneElement? : <p>I try to clone React elements like this, to pass the parent props to them (the props are not assigned in this example):</p>

<pre><code>React.createElement('div',
    {
        style: this.props.style
    },
    React.cloneElement(this.props.children, null)
)
</code></pre>

<p>This however returns following error:</p>

<blockquote>
  <p>Uncaught Invariant Violation: Element type is invalid: expected a
  string (for built-in components) or a class/function (for composite
  components) but got: undefined.</p>
</blockquote>

<p>If there is only one child or if I pass React.cloneElement(this.props.children[0], null), there is no error and the desired element is rendered.</p>

<p>How can I clone multiple elements?</p>
