Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
ReactJS - Going back in nested routes with Reacter Router Dom V6

My initial page is

http://localhost:3000/home

With a navigation bar I go to a list of products in:

http://localhost:3000/products/all/

When I click a product in the list I go to:

 http://localhost:3000/products/banana/

Now if I click Back on the browser or if I make a button with the new useNavigate and try to do navigate(-1) I go to /home in both examples.

How can I make it so I go to /products/all/ with useNavigate and hopefully I can do change the browser interaction too?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The problem in my case was that I was using replace:true when I was navigating with useNavigate from the list of the products to a particular product. Sorry if it seeemed that I didn't give enough information but this solved my issue.

https://reactrouter.com/docs/en/v6/api#usenavigate

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda