Answer the question
In order to leave comments, you need to log in
How to determine from which page you clicked?
You can use react-router-last-location, but only the route is displayed there, and the name of the previous page is not (
Answer the question
In order to leave comments, you need to log in
Where does the name come from?
In fact, from where - it does not matter. It is important where it is to convey it. If it is the title of the page, you can extract it using the standard method ( document.title
). You can store one "previous page" value or the entire history of browsing through your "pages" in the reducer or sessionStorage (if you don't have redux or don't want to clog it), and put the data there using the callback in onpopstate
Therefore, if you have redux, then you need to write So:
window.onpopstate = function(event) {
sendLastPage(document.location, document.title); // ваш_экшен_крейтор(данные_для_передачи)
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question