The React Router also maintains this mode until it is upgraded to the v4 version.To successfully use React Router, you need to forget this mode! 😮 Background story Frankly, we are very frustrated with the direction we used React Router in version 2.
Then the state of login user status will be stored in e.g. parent page component. Navbar and newsletter will be placed as children components. Moving that state from one component to another is not a big deal and you will learn how to do that in this course. First, we import the CanActivate from the @angular/router module. The AuthGuardService implements the CanActivate interface. Inject the AuthServce in the constructor of the Guard. In the CanActivate method, we will redirect the user the login page, if the user is not logged in.