I created two pages: <login>
and <dashboard>
. In login form I create userInput and passwordInput
and button submit. When the user type and click into button submit. When app start ,how to check if user logined to app, it will redirect to <dashboard>
and if user have not login to app, it will redirect to login? Thanks you for support
Check with your token in cookies or local storage with the following database users
export default function route(){
if a user exists in your DB then set validation true or either false
let validation=localStorage.getItem("token");
if(validation){
return(<Dashboard/>)
}
else{
return(<Login/>)
}