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

190
Visualizações
how to reload the page after call handleDelete but it stays on the current page,not reload to the homepage, i want stay on the current page
handleDelete: props => (id) => {
  props.deleteClaim(id)
  .then(() => {
    message.success('success delete')
  })
  setTimeout(() => {
    window.location.reload(true)
  }, 1000)
},

the problem is that every time I run the delete function on page 2, I immediately return to the main page,

how to do it so that when reloading it can stay on page 2.

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

0

Remove setTimeOut code cuz it makes you move to the main Page. "Re-load" means Browser re-load your whole page again which means Browser refresh your App and show you the main page again.

handleDelete: props => (id) => {
  props.deleteClaim(id)
  .then(() => {
    message.success('success delete')
  })
},
about 4 years ago · Juan Pablo Isaza Relatório

0

I don't think reloading the page in React is a good idea as it fails the purpose of SPA (Single Page Application). If you want to keep yourself on the page 2 then why reloading in the first place? Upon delete, you might be thinking that the deleted object should be reflected on the front-end, so for that there can be two scenarios you can do:

  • Either refetch your data
  • Or delete that the object from your front-end list upon success of your API response
about 4 years ago · Juan Pablo Isaza Relatório

0

In order to stay on the same page after refresh, the page must be on a separate route. In this case, after refreshing the page, you will remain on it. My advice to you is to use a state manager, do not complicate your life. If you want your data to be saved when the page is refreshed, you need to store it in localstorage or get it from the server. There are no other ways

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