title: React router error Cannot read property 'forEach' of undefined
body: <p>While updating react from ver 15 to ver 16 I got this error:</p>
  
  <blockquote>
    <p>Cannot read property 'forEach' of undefined in PrivateRoute component.</p>
  </blockquote>
  
  <p>Package JSON shows those versions:</p>
  
  <pre><code>"react": "^16.10.1",
  "react-dom": "^16.10.1",
  "react-router": "^5.1.1",
  "react-router-dom": "^5.1.1",
  "react-router-redux": "*"
  </code></pre>
  
  <p>Here is component code to look at: </p>
  
  <p>I tried to install eslint and eslint-loader as I found that this might be the problem but no luck</p>
  
  <pre><code>import React from "react";
  import { Route, Redirect } from "react-router-dom";
  
  const PrivateRoute = ({
      component: Component,
      Authenticated,
      AdminPage,
      Admin,
      ...props
  }) =&gt; (
      &lt;Route
          {...props}
          render={props =&gt; {
              if (AdminPage) {
                  if (Authenticated &amp;&amp; Admin) {
                      return &lt;Component {...props} /&gt;;
                  } else {
                      return (
                          &lt;Redirect
                              to={{
                                  pathname: "/",
                                  state: { from: props.location }
                              }}
                          /&gt;
                      );
                  }
              } else {
                  if (Authenticated) {
                      return &lt;Component {...props} /&gt;;
                  } else {
                      return (
                          &lt;Redirect
                              to={{
                                  pathname: "/login",
                                  state: { from: props.location }
                              }}
                          /&gt;
                      );
                  }
              }
          }}
      /&gt;
  );
  
  export default PrivateRoute;
  
  
  </code></pre>