10 - <https://reactrouter.com/>
17 import { default as Router, Route } from 'react-router'
21 <Route path='*' handler={RootView} />
25 Router.run(routes, Router.HashLocation, (Root) => {
26 React.render(<Root />, document.getElementById('all'))
34 <Route handler={Chrome}>
35 <Route path='about' handler={About} />
36 <Route path='inbox' handler={Inbox} />
37 <Route path='messages/:id' handler={Message} />
41 import { RouteHandler } from 'react-router'
43 const Chrome = React.createClass({
58 var Message = React.createClass({
59 componentDidMount: function () {
60 // from the path `/inbox/messages/:id`
61 var id = this.props.params.id
68 import { Link } from 'react-router'
70 <!-- make a named route `user` -->
71 <Link to='user' params={{userId: 10}} />
74 activeClassName='-active'
83 <DefaultRoute handler={Home} />
84 <NotFoundRoute handler={NotFound} />
86 <Redirect from='login' to='sessions/new' />
87 <Redirect from='login' to='sessions/new' params={{from: 'home'}} />
88 <Redirect from='profile/:id' to='about-user' />
90 <Route name='about-user' ... />
96 var router = Router.create({
97 routes: <Route>...</Route>,
98 location: Router.HistoryLocation
101 router.run((Root) => { ... })
107 import { Navigation } from 'react-router'
110 mixins: [ Navigation ], ...
114 .transitionTo('user', {id: 10})
115 .transitionTo('/path')
116 .transitionTo('http://...')
117 .replaceWith('about')
118 .makePath('about') // return URL
119 .makeHref('about') // return URL