I can't understand how to make a mandatory redirect when the condition is wrong.
{
login ? (
<Routes>
<Route path='/profile' element={<Profile/>}/>
<Route path='/chat' element={<Chat/>}/>
<Route path='/' element={<UserList/>}/>
</Routes>
) :
(
<Routes>
<Route path='/login' element={<Login/>}/>
<Navigate to='/login' state={{from: location}}/>
</Routes>
)
}
What's wrong?