Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

189
Views
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 answers
Answer question

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 Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!