You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
634 B
React

4 years ago
import React from 'react';
import Router from 'react-router-component';
import cx from 'classnames';
let HighlightLink = React.createClass({
mixins: [Router.NavigatableMixin],
isActive () {
// getPath() returns the path of the active Location in the current router.
return this.getPath() === this.props.href
},
render () {
let {activeClassName = 'active', className} = this.props;
className = cx(className, {[activeClassName]: this.isActive()});
return (
<Router.Link {...this.props} className={className} />
);
}
});
export default HighlightLink;