Skip to content

Commit

Permalink
[fixed] Use defaultProps of config components
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Feb 25, 2015
1 parent 67ecd77 commit 696a706
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
9 changes: 8 additions & 1 deletion modules/Configuration.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
var invariant = require('react/lib/invariant');
var RouteHandler = require('./RouteHandler');

var Configuration = {

render: function () {
getDefaultProps() {
return {
handler: RouteHandler
};
},

render() {
invariant(
false,
'%s elements are for router configuration only and should not be rendered',
Expand Down
8 changes: 1 addition & 7 deletions modules/components/Route.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var React = require('react');
var Configuration = require('../Configuration');
var PropTypes = require('../PropTypes');
var RouteHandler = require('./RouteHandler');

/**
* <Route> components specify components that are rendered to the page when the
* URL matches a given pattern.
Expand Down Expand Up @@ -53,12 +53,6 @@ var Route = React.createClass({
path: PropTypes.string,
handler: PropTypes.func,
ignoreScrollBehavior: PropTypes.bool
},

getDefaultProps: function(){
return {
handler: RouteHandler
};
}

});
Expand Down
2 changes: 1 addition & 1 deletion modules/createRoutesFromReactChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function createRouteFromReactElement(element) {
return;

var type = element.type;
var props = element.props;
var props = assign({}, type.defaultProps, element.props);

if (type.propTypes)
checkPropTypes(type.displayName, type.propTypes, props);
Expand Down

0 comments on commit 696a706

Please sign in to comment.