Created
October 28, 2017 12:47
-
-
Save Aperyon/f978884b38fa82b89b0a695d6b0127ed to your computer and use it in GitHub Desktop.
This file contains hidden or 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, Redirect, Route, Switch } from 'react-router-dom'; | |
const Nav = () => ( | |
<ul> | |
<Link to="/friends/"><li>Friends</li></Link> | |
<Link to="/books/"><li>Books</li></Link> | |
</ul> | |
) | |
const Friends = () => <h1>Friends</h1> | |
const Books = () => <h1>Books</h1> | |
const App = () => ( | |
<div> | |
<Nav /> | |
<Switch> | |
<Route exact path="/friends/" component={Friends} /> | |
<Route exact path="/books/" component={Books} /> | |
<Redirect exact from="/" to="/friends/" /> | |
</Switch> | |
</div> | |
) | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment