Skip to content

Commit 690dc91

Browse files
committed
[added] getRouteProps for route handlers
This commit adds the ability for route handlers to load props they need for a given route, optionally asynchronously. Props loaded in this manner cascade from route handlers further up the hierarchy to children, such that props loaded by children take precedence. getRouteProps should return a "hash" of props, the values of which may either be immediate or deferred using promises. As promises resolve, forceUpdate is used to re-render the <Routes>. If no props are promises, the operation is fully synchronous and route handlers will have all the props they need on the initial render. As implemented, this work should satisfy the use cases in #319, #261, #314, #374, and (indirectly) #262.
1 parent b9416bc commit 690dc91

File tree

6 files changed

+284
-113
lines changed

6 files changed

+284
-113
lines changed

modules/components/Route.js

-7
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ var Route = React.createClass({
4949

5050
displayName: 'Route',
5151

52-
propTypes: {
53-
handler: React.PropTypes.any.isRequired,
54-
getAsyncProps: React.PropTypes.func,
55-
path: React.PropTypes.string,
56-
name: React.PropTypes.string
57-
},
58-
5952
render: function () {
6053
throw new Error(
6154
'The <Route> component should not be rendered directly. You may be ' +

0 commit comments

Comments
 (0)