Skip to content

Commit

Permalink
add Navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
KaratSergio committed Jan 25, 2024
1 parent 2ac93a4 commit 5e59a11
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/components/Navigation/Navigation.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { UseSelector } from "react-redux";
import { NavLink } from 'react-router-dom';

import { UserMenu } from '../UserMenu/UserMenu'

const Navigation = () => {
const isLoggedIn = useSelector(selectIsLoggedIn);

return (
<>
<div>
<NavLink to="/">Home</NavLink>
{isLoggedIn ? (
<NavLink to="/contacts">Contacts</NavLink>
) : (
<div>
{!isLoggedIn && <Nav to="/register">Register</Nav>}
{!isLoggedIn && <Nav to="/login">Log In</Nav>}
</div>
)}
</div>

{isLoggedIn && <UserMenu />}
</>
);
};

export default Navigation;

0 comments on commit 5e59a11

Please sign in to comment.