title: Not able to use WithRouter of react-router-dom
body: <p>I am new to the react js. Here I am trying to use the <code>withrouter</code> to get the info of my location.</p>
  
  <p>SO, I have following structure.</p>
  
  <p><strong>index.js</strong></p>
  
  <pre><code>ReactDOM.render(
    &lt;App /&gt;
    , document.getElementById('root'));
  </code></pre>
  
  <p><strong>App.js</strong></p>
  
  <pre><code> &lt;Provider store={store}&gt;
          &lt;div&gt;
            &lt;Header /&gt;
            &lt;Main /&gt;
          &lt;/div&gt;
        &lt;/Provider&gt;
  </code></pre>
  
  <p><strong>Main.js</strong></p>
  
  <pre><code>return (
        &lt;Router history={history}&gt;
          &lt;div&gt;
            {this.props.isFetching &amp;&amp; &lt;Loading /&gt;}
            &lt;Switch&gt;
              &lt;PrivateRoute exact path="/" component={LandingPage} /&gt;
              &lt;PrivateRoute exact path="/create-job" component={NewJob} /&gt;
              &lt;PrivateRoute exact path="/user-jobs" component={JobList} /&gt;
              &lt;Route exact path="/login" component={Login} /&gt;
            &lt;/Switch&gt;
          &lt;/div&gt;
        &lt;/Router&gt;
  </code></pre>
  
  <p>Now, I am trying to use the withRouter in the <code>Header.js</code>. which is not a part of the <code>Router</code>. SO,</p>
  
  <pre><code>import { withRouter } from "react-router-dom";
  export default withRouter(connect(mapStateToProps, {  logout  })(Header));
  </code></pre>
  
  <p>I tried using this way. So, it is giving me the following error.</p>
  
  <pre><code>You should not use &lt;Route&gt; or withRouter() outside a &lt;Router&gt;
  </code></pre>
  
  <p>What is it that I am doing wrong over here ?</p>