Created
March 1, 2019 22:13
-
-
Save jtorreggiani/bdd2253b4b535350925a46913cab618f to your computer and use it in GitHub Desktop.
Basic React Router app
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 './App.css' | |
import { BrowserRouter as Router, Route, Link } from 'react-router-dom' | |
function Home () { | |
return ( | |
<div> | |
<h1>Home</h1> | |
</div> | |
) | |
} | |
function Todos() { | |
return ( | |
<div> | |
<h1>Todos</h1> | |
</div> | |
) | |
} | |
function About() { | |
return ( | |
<div> | |
<h1>About</h1> | |
</div> | |
) | |
} | |
function App () { | |
return ( | |
<Router> | |
<div className="App"> | |
<nav className="App-nav"> | |
<Link to="/">Home</Link> | |
<Link to="/todos">Todos</Link> | |
<Link to="/about">About</Link> | |
</nav> | |
<hr /> | |
<Route exact path="/" component={Home} /> | |
<Route path="/todos" component={Todos} /> | |
<Route path="/about" component={About} /> | |
</div> | |
</Router> | |
) | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment