1
votes

I have a list page and a details page in my web application using React Router v4. I would like to add a 'Save and close' button on my details page which, when pressed, takes the user back to the list page.

If the user goes from the list page to the details page and then presses the "Save and close" button which takes them to the list page. I would then expect if they pressed the back button on the browser then it would navigate them back to the details page. Instead what I find is the user needs to press forward on the browser history to "go back" the details page.

I am using the history.goBack() function, which from what I understand only moves the pointer back to the last location however I want it to push the last route on the location stack. I have not managed to find a way to do this.

1

1 Answers

1
votes

If you want the back navigation to go to the previous page, then you should call history.push instead of history.goBack.