title: Redirect on Login with Hashrouter
body: <pre><code>import React, {Component} from 'react';
  import {HashRouter as Router, Route} from 'react-router-dom';
  import {Provider} from 'react-redux'
  import Store from './store/configureStore'
  import Register from "./view/RegisterView"
  import Login from "./view/LoginView"
  import Dashboard from "./view/DashboardView"
  
  class App extends Component {
    constructor() {
      super();
  
    }
  
    render() {
      return (
          &lt;div&gt;
            &lt;Provider store={Store}&gt;
              &lt;Router basename="/"&gt;
                &lt;div&gt;
                    &lt;Route exact path="/register" component={Register}&gt;
                    &lt;/Route&gt;
                    &lt;Route exact path="/login" component={Login}&gt;
                    &lt;/Route&gt;
                    &lt;Route exact path="/dashboard" component={Dashboard}&gt;
                    &lt;/Route&gt;
                &lt;/div&gt;
              &lt;/Router&gt;
            &lt;/Provider&gt;
          &lt;/div&gt;
      );
    }
  }
  
  export default App;
  </code></pre>
  
  <p>I have my App.js where i give my different route. When the Login is successful i want to go to my /dashboard route. (but we can access it only when we are logged in).</p>
  
  <p>In my Login component i would like to change the route.</p>
  
  <p>I try it to change it like that:</p>
  
  <pre><code>this.props.history.push("/dashboard");
  </code></pre>
  
  <p>but history is undefined.</p>
  
  <p>I read some tutorial on google and they tell me that i can use:</p>
  
  <pre><code>onEnter={requireAuth} 
  </code></pre>
  
  <p>in my /dashboard route</p>
  
  <p>I don't know how i can change my route in my login component</p>
  
  <p>I expect to login and to come in my /dashboard route (but only if i'm connected).</p>