title: using history with react-router-dom v6
body: <p>I use <code>react-router-dom</code> <code>version 6</code> and when I use <code>this.props.history.push('/UserDashboard')</code> it does not work. I changed it to</p>
  <pre class="lang-js prettyprint-override"><code>const history = createBrowserHistory();
  history.push('/UserDashboard')
  </code></pre>
  <p>but I still have a problem that when i would like to redirect to <code>/UserDashboard</code> just the link change and the page still the first one??</p>
  <p>any help??**</p>
  <pre class="lang-js prettyprint-override"><code>        handleSubmit(event){
         
      
          event.preventDefault();
          const history = createBrowserHistory();
          axios({
            method: &quot;POST&quot;, 
            url:&quot;http://localhost:3001/users/login&quot;, 
            data:  this.state
          }).then((response)=&gt;{
            console.log(response.data.user.admin)
            if (response.data.success === true &amp;&amp; response.data.user.admin === false){
             
                    const history = createBrowserHistory();
                    history.push({
                     pathname:&quot;/users&quot;,
                     state:{
                     Key : response.data.user }
       });
      
          
             
            }else if(response.statusCode === 401 ){
              alert(&quot;Invalid username or password&quot;);
             window.location.reload(false);
            }
          })
        }
  </code></pre>
  <p>my routes.js file:</p>
  <pre class="lang-js prettyprint-override"><code>    import React from 'react';
      import { Navigate } from 'react-router-dom';
      import DashboardLayout from './Pages/DashboardLayout';
      import AccountView from './Pages/views/account/AccountView';
      import CustomerListView from './Pages/views/customer/CustomerListView';
      import DashboardView from './Pages/views/reports/DashboardView';
      import ProductListView from './Pages/views/product/ProductListView';
      import SettingsView from './Pages/views/settings/SettingsView';
      import Home from './Pages/home';
      import About from './Pages/About';
      import Partners from './Pages/Partners';
      import Services from './Pages/services';
      import Login from './Pages/Login';
      import RD from './Pages/RD';
      import ContactUs from './Pages/contactus';
      import Apply from './Pages/apply';
      import PartnerShip from './Pages/partnership';
      import News from './Pages/News';
      const routes = [
       {
       path: 'users',
       element: &lt;DashboardLayout /&gt;,
       children: [
        { path: 'account', element: &lt;AccountView /&gt; },
        { path: 'customers', element: &lt;CustomerListView /&gt; },
        { path: 'dashboard', element: &lt;DashboardView /&gt; },
        { path: 'products', element: &lt;ProductListView /&gt; },
        { path: 'settings', element: &lt;SettingsView /&gt; }
        ]
       },
      {
      path: '/',
      element: &lt;Home /&gt;,
      },
      {
      path: 'about',
      element: &lt;About /&gt;
      },
       {path: 'partners',
       element: &lt;Partners /&gt;,
      
      },
      {
      path: 'services',
      element: &lt;Services /&gt;,
      
      },
      {
      path: 'contactus',
      element: &lt;ContactUs /&gt;,
      
      },
      {
      path: 'login',
      element: &lt;Login /&gt;,
      
       },{
      path: 'RD',
      element: &lt;RD /&gt;,
      
      },
      {
      path: 'apply',
      element: &lt;Apply /&gt;,
      
       },
       {
      path: 'partnership',
      element: &lt;PartnerShip /&gt;,
      
       },
       {
      path: 'News',
      element: &lt;News /&gt;,
      
       }
      ];
  
      export default routes;
  </code></pre>