Skip to content

Commit

Permalink
Pass params/query to route handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Apr 11, 2015
1 parent e5ad53b commit 793e35e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modules/components/RouteHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,17 @@ class RouteHandler extends React.Component {

createChildRouteHandler(props) {
var route = this.context.router.getRouteAtDepth(this.getRouteDepth());
return route ? React.createElement(route.handler, assign({}, props || this.props, { ref: REF_NAME })) : null;

if (route == null)
return null;

var childProps = assign({}, props || this.props, {
ref: REF_NAME,
params: this.context.router.getCurrentParams(),
query: this.context.router.getCurrentQuery()
});

return React.createElement(route.handler, childProps);
}

render() {
Expand Down

0 comments on commit 793e35e

Please sign in to comment.