Created
January 4, 2020 23:17
-
-
Save ryanjyost/57b315d2c17b9a68f5779883639e5882 to your computer and use it in GitHub Desktop.
Example 13
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 { Link, useHistory } from "react-router-dom"; | |
import ROUTES, { RenderRoutes } from "./routes"; | |
function App() { | |
const history = useHistory(); | |
function logout() { | |
localStorage.removeItem("user"); | |
history.push("/"); | |
} | |
return ( | |
<div style={{ display: "flex", height: "100vh", alignItems: "stretch" }}> | |
<div style={{ flex: 0.3, backgroundColor: "#f2f2f2" }}> | |
{displayRouteMenu(ROUTES)} | |
<button onClick={logout}>Log Out</button> | |
</div> | |
<div> | |
<RenderRoutes routes={ROUTES} /> | |
</div> | |
</div> | |
); | |
} | |
export default App; | |
//... same stuff below |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment