Answer the question
In order to leave comments, you need to log in
How to prevent leaving the site due to history.goBack()?
In my React app I use react-router-dom for navigation.
The task was to redirect the user to the authorization form /user_registration or /user_login if he enters /special unregistered .
During execution, the following bug occurred: If you enter the application directly on /user_login, then after authorization it is thrown out of the site, since it fulfills history.goBack()
Now the question is: Is it possible to somehow prevent such an exit from the application?
For example, if there is no previous visit to the site domain in the history, throw "/" on the main page.
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