React js login status

Hi, i’ve an application and i want to put the login status, i thinked used a state but i used router, so every time i change page the nave reset the state, i use redux and router, so i thinked can i use session and jwt to controll if who use the app it’s login or theres otherway to check if someone it’s logged and don’t reset the info everytime change router?

When the user logs in, are you storing their login credentials somewhere? Whether you use redux or react or JWT or whatever, it’s simply checking that their login credentials are present.

Taking a quick look at this page, I find (down the page at “React Private Route Component”) a great example of using React and localStorage to keep the user (which could be a session thing, or a JWT, doesn’t matter). Checking for its presence is enough to determine the login status – if the user exists, then they’re logged in.