Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Create NavBar that uses custom Auth0 hook
  • Loading branch information
ivarprudnikov committed Jan 2, 2020
1 parent 4b0413d commit 07a26fe92b12f5ac1024f2bf964b0744e5e023b2
Showing 1 changed file with 18 additions and 0 deletions.
@@ -0,0 +1,18 @@
import React from "react";
import { useAuth0 } from "../react-auth0-spa";

const NavBar = () => {
const { isAuthenticated, loginWithRedirect, logout } = useAuth0();

return (
<div>
{!isAuthenticated && (
<button onClick={() => loginWithRedirect({})}>Log in</button>
)}

{isAuthenticated && <button onClick={() => logout()}>Log out</button>}
</div>
);
};

export default NavBar;

0 comments on commit 07a26fe

Please sign in to comment.