login condition if and else in router dom of react jsx 1

login condition if and else in router dom of react jsx

 let redirectToUrl;
      if ( not logged in ) //check condition
      {
        redirectToUrl = ;
      }

Here is what the above code is Doing:
1. We are checking if the user is logged in or not.
2. If the user is not logged in, we are redirecting the user to the login page.
3. If the user is logged in, we are rendering the component.

Similar Posts