title: While navigation to a path using React Router, the component state value gets reset to default
body: <p>I'm using React-Routerv4 , and when I login using the login form , i set the app component state value <code>isUser</code> to true from child component login using function <code>setUserLogin</code>, which i can debug correctly in the console after logging in. Also I have specified , that if i migrate to <code>/login</code> path ,it checks <code>isUser</code> value in state to migrate to <code>/home page</code> if user is already logged in(<code>isUser</code> is <code>true</code>) . But that value is now automatically changed to default value <code>false</code> , when i enter <code>/login</code> in the browser and it shows login page instead of home page. Im new to React , so am I missing something here? 
  Here is the code snippet : </p>
  
  <pre><code>import React from 'react';
  import ReactDom from 'react-dom';
  import 'materialize-css/bin/materialize.css'
  import 'materialize-css/bin/materialize.js';
  import {BrowserRouter as Router, Route , Redirect} from 'react-router-dom';
  import {LoginForm} from './components/login';
  import {Home} from './components/home';
  import {Main} from './components/main';
  import {Room} from './components/room';
  import "materialize-css";
  import 'materialize-css/js/toasts';
  
  
  class App extends React.Component {
      constructor(props){
          super(props);
          this.state={
              isUser : false
          }
          this.setUserLogin = this.setUserLogin.bind(this);
      }
      setUserLogin(){
          this.setState({isUser:true});
      }
      render() {
          return &lt;Router&gt;
              &lt;div&gt;
                  &lt;Route exact path="/" component={Home}/&gt;
                  &lt;Route path="/login" render={(props)=&gt;(
                      this.state.isUser ? &lt;Redirect to="/home" /&gt; : &lt;LoginForm history={props.history} setUserLogin = {this.setUserLogin}/&gt;
                  )} /&gt;
                  &lt;Route path="/home" component={Main}/&gt;
                  &lt;Route path="/room" component={Room}/&gt;
              &lt;/div&gt;
          &lt;/Router&gt;
      };
  }
  ReactDom.render(&lt;App/&gt;, document.getElementById('app'));
  </code></pre>