Created
October 28, 2017 12:05
-
-
Save Aperyon/6a328fe7b2ce2d6ac56a9d82f0e4e4c5 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, Route } from 'react-router-dom'; | |
const Nav = () => ( | |
<ul> | |
<Link to="/"><li>Home</li></Link> | |
<Link to="/friends/"><li>Friends</li></Link> | |
<Link to="/books/"><li>Books</li></Link> | |
</ul> | |
) | |
const Home = () => <h1>Home</h1> | |
const Friends = () => <h1>Friends</h1> | |
const Books = () => <h1>Books</h1> | |
const App = () => ( | |
<div> | |
<Nav /> | |
<Route path="/" component={Home} /> | |
<Route path="/friends/" component={Friends} /> | |
<Route path="/books/" component={Books} /> | |
</div> | |
) | |
export default App |
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 ReactDOM from 'react-dom'; | |
import { BrowserRouter } from 'react-router-dom'; | |
import App from './App'; | |
ReactDOM.render( | |
<BrowserRouter> | |
<App /> | |
</BrowserRouter>, | |
document.getElementById('root') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment