Created
December 19, 2018 01:49
Star
You must be signed in to star a gist
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 ReactDOM from "react-dom"; | |
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; | |
import "./styles.css"; | |
const Main = () => <h1>Main!</h1>; | |
const Elsewhere = () => <h1>Elsewhere!</h1>; | |
function App() { | |
return ( | |
<Router> | |
<div> | |
<nav> | |
<ul> | |
<li> | |
<Link to="/">Main</Link> | |
</li> | |
<li> | |
<Link to="/else">Else</Link> | |
</li> | |
</ul> | |
</nav> | |
<Switch> | |
<Route path="/" exact component={Main} /> | |
<Route path="/else/" component={Elsewhere} /> | |
</Switch> | |
</div> | |
</Router> | |
); | |
} | |
const rootElement = document.getElementById("root"); | |
ReactDOM.render(<App />, rootElement); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment