Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

194
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda