I'm using react-router-dom for routing in my ReactJS app. And I want to prevent a user from going back after login i.e I don't want the user to go back again on the login screen when he hit the back button on the browser after login.
or another example is when the user clicks the logout button, I don't want the user to be able to navigate back to the main app after logging out.
Most of the other questions I was able to find are obsolete and no longer usable for react-router v6.
Maybe I want to remove the object from the history of react-router-dom somehow?
I think there must be a method provided from react-router other than having me to set a state of isLoggedIn and check, right?