what im trying to do is change a link based on the page, so when the user is logged out it will always say login if they are logged in but not on the dashboard it will say dashboard and when they are on the dashboard it will say log out but the problem is that when you go onto the dashboard page it doesnt change,
This is a bug tracker, not a support system. For usage questions, please use Stack Overflow or Reactiflux where there are a lot more people ready to help you out. Thanks!
what im trying to do is change a link based on the page, so when the user is logged out it will always say login if they are logged in but not on the dashboard it will say dashboard and when they are on the dashboard it will say log out but the problem is that when you go onto the dashboard page it doesnt change,
{props.logged ? window.location.pathname.split('/')[1] === 'dashboard' ? <a className='nav-link' tabIndex='1' onClick={() => { props.logout(); }}>Log Out</a> : <Link to='/dashboard' className='nav-link'>Dashboard</Link> : <a onClick={() => props.login('uname', 'pword')} tabIndex='1' className='nav-link'>Login</a> }
why does this not work?