Skip to content

Commit

Permalink
[added] support for extra props in Links, fixes remix-run#170
Browse files Browse the repository at this point in the history
  • Loading branch information
brigand committed Aug 6, 2014
1 parent 0a49665 commit f3b4de8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modules/components/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var ActiveState = require('../mixins/ActiveState');
var withoutProperties = require('../helpers/withoutProperties');
var transitionTo = require('../helpers/transitionTo');
var makeHref = require('../helpers/makeHref');

var hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
/**
* A map of <Link> component props that are reserved for use by the
* router and/or React. All other props are used as params that are
Expand Down Expand Up @@ -124,6 +124,13 @@ var Link = React.createClass({
onClick: this.handleClick
};

// pull in props without overriding
for (var propName in this.props) {
if (hasOwn(this.props, propName) && hasOwn(props, propName) === false) {
props[propName] = this.props[propName];
}
}

return React.DOM.a(props, this.props.children);
}

Expand Down

0 comments on commit f3b4de8

Please sign in to comment.