title: React JS: Expected a string but got: object
body: <p>I have an icon.js file as shown below to export the icons of your need:</p>
  <pre><code>import RotateLeftIcon from '@material-ui/icons/RotateLeft';
  
  const iconTypes = {
    LEFT_ROTATION: &lt;RotateLeftIcon /&gt;,
  };
  
  export const iconNames = {
    LEFT_ROTATION: 'LEFT_ROTATION',
  };
  
  export const getIcon = (iconName, props) =&gt; {
    const Component = iconTypes[iconName];
    return &lt;Component style={{ ...props }} /&gt;;
  };
  
  </code></pre>
  <p>and I call them like this:</p>
  <pre><code>import React from 'react'
  
  export default function TestingIcons() {
      return getIcon(iconNames.LEFT_ROTATION, {
          color: '#fff',
          fontSize: '1rem',
        });
  }
  </code></pre>
  <p>When I do the above, I get this error: <code>Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.</code></p>
  <p>How to fix this?</p>