Why Login page doesn't reset state when navigating to Home page?

261 Views Asked by At

I am using react-navigation and when a user logs in, it redirects to Home screen. However, when I go back to Login, I can see the state is not reset. Basically, it is keeping state the same as I left when navigating to Home.

this.state = {
   loading: false
};

Case explanation : when log in clicked, set loading to true and go to home screen. In Home screen click Back which redirects to Login, where loading is still set to True.

That seems odd, never experienced that. I thought react sets state on load.

0

There are 0 best solutions below