Skip to content

Commit 0cf3d56

Browse files
committed
Use class set for generating <Link> className
1 parent bd23312 commit 0cf3d56

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

modules/components/Link.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var React = require('react');
2+
var classSet = require('react/lib/cx');
23
var merge = require('react/lib/merge');
34
var ActiveState = require('../mixins/ActiveState');
45
var Navigation = require('../mixins/Navigation');
@@ -80,12 +81,15 @@ var Link = React.createClass({
8081
* the value of the activeClassName property when this <Link> is active.
8182
*/
8283
getClassName: function () {
83-
var className = this.props.className || '';
84+
var classNames = {};
85+
86+
if (this.props.className)
87+
classNames[this.props.className] = true;
8488

8589
if (this.isActive(this.props.to, this.props.params, this.props.query))
86-
className += ' ' + this.props.activeClassName;
90+
classNames[this.props.activeClassName] = true;
8791

88-
return className;
92+
return classSet(classNames);
8993
},
9094

9195
render: function () {

0 commit comments

Comments
 (0)