Last active
December 22, 2017 05:57
-
-
Save astrotim/20645c0c433d07a1d80a6628d054a046 to your computer and use it in GitHub Desktop.
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, { Component } from 'react'; | |
+import { BrowserRouter, Link, Switch, Route } from 'react-router-dom'; | |
+import Home from './Home'; | |
+import Post from './Post'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
class App extends Component { | |
render() { | |
return ( | |
+ <BrowserRouter> | |
<div className="App"> | |
<header className="App-header"> | |
+ <Link to="/"> | |
<img src={logo} className="App-logo" alt="logo" /> | |
+ </Link> | |
<h1 className="App-title">Welcome to React</h1> | |
+ <Link to="/">Home</Link> <Link to="/post/">Post</Link> | |
</header> | |
- <p className="App-intro"> | |
- To get started, edit <code>src/App.js</code> and save to reload. | |
- </p> | |
+ <Switch> | |
+ <Route exact path="/" component={Home} /> | |
+ <Route path="/post/" component={Post} /> | |
+ </Switch> | |
</div> | |
+ </BrowserRouter> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment