-
20 | {this.props.routes.map((item, index) =>
21 |
- 22 | 26 | {item.component.title} 27 | 28 | {(index + 1) < depth && '\u2192'} 29 | 30 | )} 31 |
├── tests.node.js ├── logo ├── horizontal.png ├── vertical.png ├── vertical@2x.png └── horizontal@2x.png ├── modules ├── __tests__ │ ├── .eslintrc │ ├── shouldWarn.js │ ├── resetHash.js │ ├── execSteps.js │ ├── getParamNames-test.js │ ├── IndexRedirect-test.js │ ├── withRouter-test.js │ ├── _bc-History-test.js │ ├── RouteComponent-test.js │ ├── matchPattern-test.js │ ├── AsyncUtils-test.js │ ├── push-test.js │ ├── Redirect-test.js │ ├── useRouterHistory-test.js │ ├── createRoutesFromReactChildren-test.js │ ├── IndexRoute-test.js │ └── _bc-serverRendering-test.js ├── hashHistory.js ├── browserHistory.js ├── IndexLink.js ├── createRouterHistory.js ├── useRouterHistory.js ├── RoutingContext.js ├── routerWarning.js ├── History.js ├── getRouteParams.js ├── createMemoryHistory.js ├── withRouter.js ├── RouterUtils.js ├── InternalPropTypes.js ├── RouteContext.js ├── applyRouterMiddleware.js ├── useRoutes.js ├── index.js ├── Route.js ├── IndexRedirect.js ├── IndexRoute.js ├── deprecateObjectProperties.js ├── AsyncUtils.js ├── getComponents.js ├── match.js ├── Lifecycle.js ├── computeChangedRoutes.js ├── Redirect.js ├── PropTypes.js ├── RouteUtils.js ├── TransitionUtils.js ├── RouterContext.js └── Link.js ├── .gitignore ├── examples ├── auth-with-shared-root │ ├── components │ │ ├── About.js │ │ ├── PageOne.js │ │ ├── PageTwo.js │ │ ├── User.js │ │ ├── Logout.js │ │ ├── Dashboard.js │ │ ├── Landing.js │ │ ├── App.js │ │ └── Login.js │ ├── app.js │ ├── index.html │ ├── utils │ │ └── auth.js │ └── config │ │ └── routes.js ├── huge-apps │ ├── routes │ │ ├── Grades │ │ │ ├── index.js │ │ │ └── components │ │ │ │ └── Grades.js │ │ ├── Profile │ │ │ ├── index.js │ │ │ └── components │ │ │ │ └── Profile.js │ │ ├── Calendar │ │ │ ├── index.js │ │ │ └── components │ │ │ │ └── Calendar.js │ │ ├── Messages │ │ │ ├── index.js │ │ │ └── components │ │ │ │ └── Messages.js │ │ └── Course │ │ │ ├── routes │ │ │ ├── Grades │ │ │ │ ├── index.js │ │ │ │ └── components │ │ │ │ │ └── Grades.js │ │ │ ├── Assignments │ │ │ │ ├── routes │ │ │ │ │ └── Assignment │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── components │ │ │ │ │ │ └── Assignment.js │ │ │ │ ├── components │ │ │ │ │ ├── Assignments.js │ │ │ │ │ └── Sidebar.js │ │ │ │ └── index.js │ │ │ └── Announcements │ │ │ │ ├── routes │ │ │ │ └── Announcement │ │ │ │ │ ├── index.js │ │ │ │ │ └── components │ │ │ │ │ └── Announcement.js │ │ │ │ ├── components │ │ │ │ ├── Announcements.js │ │ │ │ └── Sidebar.js │ │ │ │ └── index.js │ │ │ ├── components │ │ │ ├── Dashboard.js │ │ │ ├── Nav.js │ │ │ └── Course.js │ │ │ └── index.js │ ├── components │ │ ├── App.js │ │ ├── Dashboard.js │ │ └── GlobalNav.js │ ├── index.html │ ├── stubs │ │ └── COURSES.js │ └── app.js ├── README.md ├── global.css ├── sidebar │ ├── index.html │ ├── app.css │ ├── data.js │ └── app.js ├── pinterest │ ├── index.html │ └── app.js ├── active-links │ ├── index.html │ └── app.js ├── query-params │ ├── index.html │ └── app.js ├── master-detail │ ├── index.html │ ├── app.css │ └── ContactStore.js ├── route-no-match │ ├── index.html │ └── app.js ├── auth-flow │ ├── index.html │ ├── auth.js │ └── app.js ├── dynamic-segments │ ├── index.html │ └── app.js ├── nested-animations │ ├── index.html │ ├── app.css │ └── app.js ├── animations │ ├── index.html │ ├── app.css │ └── app.js ├── breadcrumbs │ ├── index.html │ ├── app.css │ └── app.js ├── confirming-navigation │ ├── index.html │ └── app.js ├── passing-props-to-children │ ├── index.html │ ├── app.css │ └── app.js ├── auth-flow-async-with-query-params │ ├── index.html │ └── app.js ├── server.js ├── webpack.config.js └── index.html ├── .eslintrc ├── .babelrc ├── SPONSORS.md ├── .travis.yml ├── scripts ├── build.js └── release.sh ├── docs ├── guides │ ├── README.md │ ├── NavigatingOutsideOfComponents.md │ ├── ConfirmingNavigation.md │ ├── MinimizingBundleSize.md │ ├── RouteMatching.md │ ├── IndexRoutes.md │ ├── DynamicRouting.md │ ├── ServerRendering.md │ ├── ComponentLifecycle.md │ └── testing.md ├── README.md └── Troubleshooting.md ├── webpack.config.js ├── upgrade-guides ├── v2.2.0.md └── v2.4.0.md ├── tests.webpack.js ├── LICENSE.md ├── ISSUE_TEMPLATE.md ├── CONTRIBUTING.md ├── CODE_OF_CONDUCT.md ├── package.json └── karma.conf.js /tests.node.js: -------------------------------------------------------------------------------- 1 | import './modules/__tests__/serverRendering-test' 2 | -------------------------------------------------------------------------------- /logo/horizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/react-router/master/logo/horizontal.png -------------------------------------------------------------------------------- /logo/vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/react-router/master/logo/vertical.png -------------------------------------------------------------------------------- /logo/vertical@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/react-router/master/logo/vertical@2x.png -------------------------------------------------------------------------------- /logo/horizontal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/react-router/master/logo/horizontal@2x.png -------------------------------------------------------------------------------- /modules/__tests__/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "mocha": true 4 | }, 5 | "rules": { 6 | "react/prop-types": 0 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | es6 2 | lib 3 | umd 4 | examples/**/*-bundle.js 5 | node_modules 6 | npm-debug.log 7 | website/index.html 8 | website/tags/* 9 | coverage 10 | -------------------------------------------------------------------------------- /modules/__tests__/shouldWarn.js: -------------------------------------------------------------------------------- 1 | /*eslint no-console: 0*/ 2 | 3 | export default function shouldWarn(about) { 4 | console.error.expected.push(about) 5 | } 6 | -------------------------------------------------------------------------------- /modules/hashHistory.js: -------------------------------------------------------------------------------- 1 | import createHashHistory from 'history/lib/createHashHistory' 2 | import createRouterHistory from './createRouterHistory' 3 | export default createRouterHistory(createHashHistory) 4 | 5 | -------------------------------------------------------------------------------- /modules/browserHistory.js: -------------------------------------------------------------------------------- 1 | import createBrowserHistory from 'history/lib/createBrowserHistory' 2 | import createRouterHistory from './createRouterHistory' 3 | export default createRouterHistory(createBrowserHistory) 4 | 5 | -------------------------------------------------------------------------------- /examples/auth-with-shared-root/components/About.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const About = React.createClass({ 4 | render() { 5 | return
You are now logged out
11 | } 12 | }) 13 | 14 | export default Logout 15 | -------------------------------------------------------------------------------- /modules/IndexLink.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Link from './Link' 3 | 4 | /** 5 | * AnChoose an assignment from the sidebar.
} 9 |Choose an announcement from the sidebar.
} 9 |You made it!
12 |{token}
13 | {this.props.children} 14 |This page is only shown to unauthenticated users.
10 |Partial / Lazy loading. Open the network tab while you navigate. Notice that only the required components are downloaded as you navigate around.
11 |{body}
13 |{body}
13 |12 | Open the network tab as you navigate. Notice that only the amount of 13 | your app that is required is actually downloaded as you navigate 14 | around. Even the route configuration objects are loaded on the fly. 15 | This way, a new route added deep in your app will not affect the 16 | initial bundle of your application. 17 |
18 |location.state)Go to Home Page
41 |Animations with React Router are not different than any other animation.
39 |Lorem ipsum dolor sit amet, consectetur adipisicing elit. Do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
50 |Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
61 |{category.description}
16 | )} 17 |${menuItem.price}
51 |62 | Routes can have multiple components, so that all portions of your UI 63 | can participate in the routing. 64 |
65 |You are {!this.state.loggedIn && 'not'} logged in.
} 39 |You made it!
52 |{token}
53 |You are now logged out
115 | } 116 | }) 117 | 118 | function requireAuth(nextState, replace) { 119 | if (!auth.loggedIn()) { 120 | replace({ 121 | pathname: '/login', 122 | state: { nextPathname: nextState.location.pathname } 123 | }) 124 | } 125 | } 126 | 127 | render(( 128 |Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
81 |Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
92 |