title: Navigate to the URL without react-router - "_this.props.history is undefined" error
body: <p>I'm trying to check authentity using tokens while loading the app and when user is not authorized navigate him to the log-in page. This method is inserted into Navbar component because it is on every page in the app, so it will be called any time. I tried to place the navbar component inside the Router but it doesn't work. The App.js with routing:</p>
  
  <pre><code>      &lt;div className="App"&gt;
         &lt;HomeNavbar history={this.props.history}/&gt;
         &lt;Router&gt;
         &lt;Switch&gt;
           &lt;Route exact path="/login" component={LoginPage}/&gt;
           &lt;Route exact path="/addEvent" component={addEvent}/&gt;
           &lt;Route exact path="/register" component={RegisterPage}/&gt;
           &lt;Route exact path="/members" component={MembersList}/&gt;
           &lt;Route exact path="/event/:id" component={EventDetails}/&gt;
           &lt;Route exact path="/events" component={EventsList}/&gt;
           &lt;Route exact path="/user/:id" component={UserDetails}/&gt;
           &lt;Route path="/" component={EventsList}/&gt;
         &lt;/Switch&gt;
         &lt;/Router&gt;
        &lt;/div&gt;
  </code></pre>
  
  <p>As you can see HomeNavbar is outside the  but I want it that way because it displays on every page. How can I navigate to the other page from that component?</p>