I'm working on a react app, the issue is that after logging in and click on back button inside browser I can see the login page,
What should be the best approach to prevent this?
Can you guide me a little bit??
If you are using react-router you can use redirect in your login component
if (userIsLogged) {
return <Redirect to={"/homepage"} />;
}
You can use Route Gurad Module
https://www.npmjs.com/package/react-router-guards or refer to this example as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.