Created
October 9, 2020 00:58
-
-
Save mbrown3321/078af8e58c6c9f67c998f4b2e43278fb to your computer and use it in GitHub Desktop.
App.js with user profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Navbar, Nav, Button } from "react-bootstrap" | |
import { useAuth0 } from "@auth0/auth0-react"; | |
import 'bootstrap/dist/css/bootstrap.min.css'; | |
import UserProfile from "./UserProfile"; | |
const App = () => { | |
const { loginWithRedirect, isAuthenticated, logout } = useAuth0(); | |
return ( | |
<div> | |
<Navbar bg="dark" variant="dark"> | |
<Navbar.Brand href="#home">Auth0</Navbar.Brand> | |
<Nav className="ml-auto"> | |
{ | |
isAuthenticated | |
? ( | |
<Button onClick={() => logout()}>Logout</Button> | |
) : ( | |
<Button onClick={() => loginWithRedirect()}>Login</Button> | |
) | |
} | |
</Nav> | |
</Navbar> | |
<UserProfile /> | |
</div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment