title: Failed prop type: The prop `location` is marked as required in `PrivateRoute`, but its value is `undefined`
body: <p>To give access to authenticated users only, I created a component PrivateRoute like described <a href="https://github.com/strapi/strapi-examples/tree/57e21644248c66e15c36c840671589178e5a5011/good-old-react-authentication-flow" rel="nofollow noreferrer">here</a>. Everything works fine, but it gives me a warning, that 'location' is undefined.</p>
  <pre><code>import React from 'react';
  import PropTypes from 'prop-types';
  import { Redirect, Route } from 'react-router-dom';
  import auth from '../../hooks/login/auth';
  
  const PrivateRoute = ({ component: Component, ...rest }) =&gt; (
    &lt;Route
      {...rest}
      render={(props) =&gt; (
        auth.getToken() !== null ? (
          &lt;Component {...props} /&gt;
        ) : (
          &lt;Redirect to={{
            pathname: '/log_in',
            state: { from: props.location },
          }}
          /&gt;
        )
      )}
    /&gt;
  );
  
  PrivateRoute.propTypes = {
    component: PropTypes.any.isRequired, // eslint-disable-line
    location: PropTypes.shape({
      pathname: PropTypes.string.isRequired,
    }).isRequired,
  };
  
  export default PrivateRoute;
  </code></pre>
  <pre><code>&lt;Switch&gt;
     &lt;Route exact path=&quot;/&quot; component={LogIn} /&gt;
     &lt;Route exact path=&quot;/log_in&quot; component={LogIn} /&gt;
     &lt;PrivateRoute exact path=&quot;/dashboard&quot; component={Dashboard} /&gt;
  &lt;/Switch&gt;
  </code></pre>
  <p>If I make a console log in the render method, location is always defined. So wtf?</p>
  <pre><code>&lt;Route
      {...rest}
      render={(props) =&gt; {
        console.log('LOCATION', props.location);
        return auth.getToken() !== null ? (
          &lt;Component {...props} /&gt;
        ) : (
          &lt;Redirect to={{
            pathname: '/log_in',
            state: { from: props.location },
          }}
          /&gt;
        );
      }}
    /&gt;
  </code></pre>
  <p>I have tried to give location a default value, but then the whole page was blank.</p>
  <pre><code>PrivateRoute.propTypes = {
    component: PropTypes.any.isRequired, // eslint-disable-line
    location: PropTypes.shape({
      pathname: PropTypes.string.isRequired,
    }),
  };
  
  PrivateRoute.defaultProps = {
     location: {
      pathname: '',
     },
  };
  </code></pre>
  <p>What is the problem here? And how is it possible that location is undefined when any console log output shows a defined location object?</p>