I’m using Navigate from react-router-dom.
I have a page1 that automatically redirects to login like this:
//Code on page1
<Navigate
to={{
pathname: "/login",
state: {
// sets the location a user was about to access before being redirected to login
from: location.pathname,
},
}}
/>
When I click the back button on login, i stay on the login page because page1 redirects to login. How do I go two pages back such that Home->page1->login and pressing back from login goes to Home?