title: React Router v4 Redirecting on form submit
body: <p>Brand new to react, Attempting to redirect to a "homepage" after clicking submit on a "login" page. Tried to follow the react router tutorial.</p>
  
  <p>When I click the submit button on the form and console log the state and fakeAuth.isAuthenticated, they both return true. However, the redirect is not firing.</p>
  
  <p><strong>Login.js</strong></p>
  
  <pre><code>class Login extends Component {
      constructor(props) {
          super(props);
          this.state = {
              portalId: "",
              password: "",
              redirectToReferrer: false
          }
  
          this.handleSubmit = this.handleSubmit.bind(this);
      }
  
  
      handleSubmit(e) {
          fakeAuth.authenticate(() =&gt; {
              this.setState({
                  portalId: this.refs.portalId.value,
                  password: this.refs.password.value,
                  redirectToReferrer: true
              })
          })
          e.preventDefault();
      }
  
  
      render() {
          const redirectToReferrer = this.state.redirectToReferrer;
          if (redirectToReferrer === true) {
              &lt;Redirect to="/home" /&gt;
          }
  </code></pre>
  
  <p><strong>Routes.js</strong></p>
  
  <pre><code>export const fakeAuth = {
      isAuthenticated: false,
      authenticate(cb) {
          this.isAuthenticated = true
          setTimeout(cb, 100)
      },
      signout(cb) {
          this.isAuthenticated = false
          setTimeout(cb, 100)
      }
  }
  
  const PrivateRoute = ({ component: Component, ...rest }) =&gt; (
      &lt;Route {...rest} render={() =&gt; (
          fakeAuth.isAuthenticated === true
          ? &lt;Component {...this.props}/&gt;
          : &lt;Redirect to="/" /&gt;
      )}/&gt; 
  )
  
  
  export default () =&gt; (
      &lt;BrowserRouter&gt;
          &lt;div&gt;
              &lt;Navbar /&gt;
              &lt;Switch&gt;
                  &lt;Route path="/" exact component={Login} /&gt;
                  &lt;Route path="/register" exact component={Register} /&gt;
                  &lt;Route path="/home" exact component={Home} /&gt;
              &lt;/Switch&gt;
          &lt;/div&gt;
      &lt;/BrowserRouter&gt;
  );
  </code></pre>