Return to Snippet

Revision: 70677
at June 8, 2016 00:22 by dylansong


Initial Code
import React from 'react';
import { Router, Route, Link, hashHistory } from 'react-router';

const Home = ( props ) => <div><h1>Home</h1><Links />{props.children}</div>;
const About = ( props ) => <div><h1>About</h1>{props.children}</div>;
const Contact = () => <div><h1>Contact</h1></div>;
const Links = () =>
    <nav>
      <Link to="/">Home</Link>
      <Link to="/about">About</Link>
      {/* <Link to="/contact">Contact</Link> */}
      <Link to="/about/contact">Contact</Link>
    </nav>

const App = () => {
  return (
    <Router history={ hashHistory }>
      <Route path="/" component={ Home }>
        <Route path="about" component={ About }>
          {/* <Route path="/contact" component={ Contact }></Route> */}
          <Route path="contact" component={ Contact }></Route>
        </Route>
      </Route>
    </Router>
  )
};

export default App;

Initial URL


Initial Description


Initial Title
4.nested-routes/

Initial Tags


Initial Language
Other