title: React Unhandled Rejection (Invariant Violation)
body: <p>I'm having some problems with authentication in my React template.
  When I'm logged in it work's fine, but when I log out I'm receiving message like.</p>
  
  <blockquote>
    <p>Unhandled Rejection (Invariant Violation): Element type is invalid:
    expected a string (for built-in components) or a class/function (for
    composite components) but got: object.</p>
    
    <p>Check the render method of <code>Route</code>.</p>
  </blockquote>
  
  <p>Here is how my code looks like.</p>
  
  <pre><code>const Dashboard = ({ match, isAuthenticated }) =&gt; (
      &lt;Col span={24}&gt;
          &lt;Menu
              mode="horizontal"
          &gt;
              &lt;Menu.Item key="News"&gt;
                  &lt;Link to="./News"&gt;&lt;i className="icon icon-alert gx-text-white" /&gt; News&lt;/Link&gt;
              &lt;/Menu.Item&gt;
              &lt;Menu.Item key="Servers"&gt;
                  &lt;Link to="./Servers"&gt;&lt;i className="icon icon-widgets gx-text-white" /&gt;Servers&lt;/Link&gt;
              &lt;/Menu.Item&gt;
              &lt;Menu.Item key="Billing"&gt;
                  &lt;Link to="./Billing"&gt;&lt;i className="icon icon-pricing-table gx-text-white" /&gt;Billing&lt;/Link&gt;
              &lt;/Menu.Item&gt;
              &lt;Menu.Item key="Support"&gt;
                  &lt;Link to="./Support"&gt;&lt;i className="icon icon-chat-bubble gx-text-white" /&gt;Support&lt;/Link&gt;
              &lt;/Menu.Item&gt;
              &lt;Menu.Item key="Logs"&gt;
                  &lt;Link to="./Logs"&gt;&lt;i className="icon icon-plain-list-divider gx-text-white" /&gt;Activity Logs&lt;/Link&gt;
              &lt;/Menu.Item&gt;
          &lt;/Menu&gt;
          &lt;Switch&gt;
              &lt;Redirect exact from={`${match.url}/`} to={`${match.url}/News`} /&gt;
  
              &lt;Route path={`${match.url}/servers`}
                  component={isAuthenticated ? asyncComponent(() =&gt; import('./Servers')) :
                      &lt;Redirect to="/home" /&gt;} /&gt;
          &lt;/Switch &gt;
      &lt;/Col&gt;
  );
  
  const mapStateToProps = state =&gt; {
      return {
          isAuthenticated: state.auth.token !== null
      };
  };
  
  export default connect(mapStateToProps, null)(Dashboard);
  </code></pre>