title: How can I get history of React Router Dom in Version 6 with React Class Component
body: <p>I need to get <code>history</code> object. I am using version 6 of <code>react-router-dom</code> &amp; I also installed <code>react-router</code> v6.
  Here this is my code of one class component.</p>
  <pre><code>import React, { Component } from 'react'
  import { withRouter } from 'react-router'
  
  class Blog extends Component {
      render() {
          console.log(this.props)
          return (
              &lt;div&gt;
                  &lt;h4&gt;History&lt;/h4&gt;
              &lt;/div&gt;
          )
      }
  }
  const B = withRouter(Blog)
  export default B
  </code></pre>
  <p>&amp; I import it to another component.</p>
  <pre><code>import React, { Component } from 'react'
  import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
  import B from './pages/Blog'
  
  class Lesson2 extends Component {
      render() {
          return (
              &lt;BrowserRouter&gt;
                  &lt;div&gt;
                      &lt;h4&gt;Lesson 2&lt;/h4&gt;
                      &lt;MainNav /&gt;
                      &lt;Routes&gt;
                          &lt;Route path='/blog/' element={&lt;B /&gt;}/&gt;
                      &lt;/Routes&gt;
                  &lt;/div&gt;
              &lt;/BrowserRouter &gt;
          )
      }
  }
  
  export default Lesson2
  </code></pre>
  <p>I am getting error <code>Attempted import error: 'withRouter' is not exported from 'react-router'</code> Although I install both <code>react-router</code> &amp; <code>react-router-dom</code>.</p>