Answer the question
In order to leave comments, you need to log in
React Router and .goBack(): How to undo a site visit?
Good afternoon. The site has a back
button that, when clicked, takes the user to the previous page.
Implemented using react-router :
The problem is that if the user came to the site from another site, for example from google.com -> mysite.com . Then by clicking on the back button it will go to google.com And you need to make it so that if by clicking on the back the user can get (leave the site), then in this case, either hide the button or redirect the user to the main page of the site.
Can you please tell me how can I do this with react-router?
history.goBack();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question