Skip to content

Commit

Permalink
[added] getRouteProps for route handlers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mjackson committed Oct 13, 2014
1 parent b9416bc commit 690dc91
Show file tree
Hide file tree
Showing 6 changed files with 284 additions and 113 deletions.
7 changes: 0 additions & 7 deletions modules/components/Route.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ var Route = React.createClass({

displayName: 'Route',

propTypes: {
handler: React.PropTypes.any.isRequired,
getAsyncProps: React.PropTypes.func,
path: React.PropTypes.string,
name: React.PropTypes.string
},

render: function () {
throw new Error(
'The <Route> component should not be rendered directly. You may be ' +
Expand Down
Loading

0 comments on commit 690dc91

Please sign in to comment.