Skip to content

Commit f3b4de8

Browse files
committed
[added] support for extra props in Links, fixes #170
1 parent 0a49665 commit f3b4de8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

modules/components/Link.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var ActiveState = require('../mixins/ActiveState');
33
var withoutProperties = require('../helpers/withoutProperties');
44
var transitionTo = require('../helpers/transitionTo');
55
var makeHref = require('../helpers/makeHref');
6-
6+
var hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
77
/**
88
* A map of <Link> component props that are reserved for use by the
99
* router and/or React. All other props are used as params that are
@@ -124,6 +124,13 @@ var Link = React.createClass({
124124
onClick: this.handleClick
125125
};
126126

127+
// pull in props without overriding
128+
for (var propName in this.props) {
129+
if (hasOwn(this.props, propName) && hasOwn(props, propName) === false) {
130+
props[propName] = this.props[propName];
131+
}
132+
}
133+
127134
return React.DOM.a(props, this.props.children);
128135
}
129136

0 commit comments

Comments
 (0)