-
-
Save f4ww4z/eecfdb81d26e1d6f344628ac9f7fe4ed 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, { Component } from 'react'; | |
import { Router, browserHistory, Route, Link } from 'react-router'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
const Page = ({ title }) => ( | |
<div className="App"> | |
<div className="App-header"> | |
<img src={logo} className="App-logo" alt="logo" /> | |
<h2>{title}</h2> | |
</div> | |
<p className="App-intro"> | |
This is the {title} page. | |
</p> | |
<p> | |
<Link to="/">Home</Link> | |
</p> | |
<p> | |
<Link to="/about">About</Link> | |
</p> | |
<p> | |
<Link to="/settings">Settings</Link> | |
</p> | |
</div> | |
); | |
const Home = (props) => ( | |
<Page title="Home"/> | |
); | |
const About = (props) => ( | |
<Page title="About"/> | |
); | |
const Settings = (props) => ( | |
<Page title="Settings"/> | |
); | |
class App extends Component { | |
render() { | |
return ( | |
<Router history={browserHistory}> | |
<Route path="/" component={Home}/> | |
<Route path="/about" component={About}/> | |
<Route path="/settings" component={Settings}/> | |
</Router> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment