title: ReactJS SPA project back / forward buttons on browser won't save the user path
body: <p>I'm having a problem while trying to develop a SPA project with ReactJS, which back/forward buttons on browser won't work, like if the path of the user is not saving, something that's not happening with another project of a friend of mine ( he's developing a SPA too ).
  I will show some demos below and the way I'm redirecting the user.</p>
  <p>Redirect method</p>
  <pre class="lang-js prettyprint-override"><code>import {useNavigate} from &quot;react-router-dom&quot;;
  const navigate = useNavigate()
      const redirect = (url)=&gt;{
          navigate(url, {replace:true})
      }
  &lt;Navbar.Brand onClick={()=&gt;{redirect('/')}}&gt;eCommerce&lt;/Navbar.Brand&gt;
  </code></pre>
  <p>Video : <a href="https://drive.google.com/file/d/1klkTUxOtgr0oJIOAMRCOnoPKu0Ac7x9e/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1klkTUxOtgr0oJIOAMRCOnoPKu0Ac7x9e/view?usp=sharing</a></p>