text: import React, { useState, useEffect } from "react";
  import { Link, withRouter } from "react-router-dom";
  import { Nav, Navbar, NavItem } from "react-bootstrap";
  import { LinkContainer } from "react-router-bootstrap";
  import Routes from "./Routes";
  import { Auth } from "aws-amplify";
  import logo from "./static/logo.png"
  import "./App.css";
  
  function App(props) {
    const [isAuthenticated, userHasAuthenticated] = useState(false);
    const [isAuthenticating, setIsAuthenticating] = useState(true);
  
    useEffect(() => {
      onLoad();
    }, []);
  
    async function onLoad() {
      try {
        await Auth.currentSession();
        userHasAuthenticated(true);
      } catch (e) {
        if (e !== "No current user") {
          alert(e);
        }
      }
  
      setIsAuthenticating(false);
    }
  
    async function handleLogout() {
      await Auth.signOut();
  
      userHasAuthenticated(false);
  
      props.history.push("/login");
    }
  
    return (
      !isAuthenticating && (
        <div className="App container">
          <div className="logo">
            <Link to="/">
              <img src={logo} alt="Logo"></img>
            </Link>
          </div>
          <Navbar fluid collapseOnSelect className='Navigation'>
            <Navbar.Header>
              <Navbar.Toggle />
            </Navbar.Header>
            <Navbar.Collapse>
              <Nav pullRight>
                {isAuthenticated ? (
                  <NavItem onClick={handleLogout}>Logout</NavItem>
                ) : (
                  <>
                    <LinkContainer to="/signup">
                      <NavItem>Signup</NavItem>
                    </LinkContainer>
                    <LinkContainer to="/login">
                      <NavItem>Login</NavItem>
                    </LinkContainer>
                  </>
                )}
              </Nav>
            </Navbar.Collapse>
          </Navbar>
          <Routes appProps={{ isAuthenticated, userHasAuthenticated }} />
        </div>
      )
    );
  }
  
  export default withRouter(App);
  