Skip to content

Commit 8086698

Browse files
committed
Use constant instead of prop
1 parent fe5ec39 commit 8086698

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

modules/RouteHandlerMixin.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
var React = require('react');
2+
var assign = require('react/lib/Object.assign');
23
var PropTypes = require('./PropTypes');
34

5+
var REF_NAME = '__routeHandler__';
6+
47
var RouteHandlerMixin = {
58

69
contextTypes: {
@@ -19,12 +22,6 @@ var RouteHandlerMixin = {
1922
};
2023
},
2124

22-
getDefaultProps: function () {
23-
return {
24-
ref: '__routeHandler__'
25-
};
26-
},
27-
2825
componentDidMount: function () {
2926
this._updateRouteComponent();
3027
},
@@ -34,7 +31,7 @@ var RouteHandlerMixin = {
3431
},
3532

3633
_updateRouteComponent: function () {
37-
this.context.setRouteComponentAtDepth(this.getRouteDepth(), this.refs[this.props.ref]);
34+
this.context.setRouteComponentAtDepth(this.getRouteDepth(), this.refs[REF_NAME]);
3835
},
3936

4037
getRouteDepth: function () {
@@ -43,7 +40,7 @@ var RouteHandlerMixin = {
4340

4441
createChildRouteHandler: function (props) {
4542
var route = this.context.getRouteAtDepth(this.getRouteDepth());
46-
return route ? React.createElement(route.handler, props || this.props) : null;
43+
return route ? React.createElement(route.handler, assign({}, props || this.props, { ref: REF_NAME })) : null;
4744
}
4845

4946
};

0 commit comments

Comments
 (0)