Skip to content

Commit 793e35e

Browse files
committed
Pass params/query to route handlers
1 parent e5ad53b commit 793e35e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

modules/components/RouteHandler.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,17 @@ class RouteHandler extends React.Component {
3939

4040
createChildRouteHandler(props) {
4141
var route = this.context.router.getRouteAtDepth(this.getRouteDepth());
42-
return route ? React.createElement(route.handler, assign({}, props || this.props, { ref: REF_NAME })) : null;
42+
43+
if (route == null)
44+
return null;
45+
46+
var childProps = assign({}, props || this.props, {
47+
ref: REF_NAME,
48+
params: this.context.router.getCurrentParams(),
49+
query: this.context.router.getCurrentQuery()
50+
});
51+
52+
return React.createElement(route.handler, childProps);
4353
}
4454

4555
render() {

0 commit comments

Comments
 (0)