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 { Router, Route, Link, IndexRoute, hashHistory, browserHistory, DefaultRoute } from 'react-router' | |
class App extends Component { | |
render () { | |
return ( | |
<Router history={hashHistory}> | |
<Route path='/' component={Container}> | |
<IndexRoute component={Home} /> | |
<Route path='address' component={Address} /> | |
<Route path='*' component={NotFound} /> | |
</Route> | |
</Router> | |
) | |
} | |
} | |
const Nav = () => ( | |
<div> | |
<Link to='/'>Home</Link> | |
<Link to='/address'>Address</Link> | |
</div> | |
) | |
const Container = (props) => <div> | |
<Nav /> | |
{props.children} | |
</div> | |
const Home = () => <h1>Hello from Home!</h1> | |
const Address = () => <h1>We are located at 555 Jackson St.</h1> | |
const NotFound = () => <h1>404.. This page is not found!</h1> | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment