let redirectToUrl; if ( not logged in ) //check condition { redirectToUrl = <Redirect to={loginPage}/>; }