andreypopp/rrouter — pull request #24 by MattAitchison (2014-06-03 13:35:29+00:00)
Title: Created LinkMixin to create your own Link components

Could use it like the following. (I will add an example for this.)

```
var React = require('react');
var RRouter = require('rrouter');
var LinkMixin = RRouter.LinkMixin;
var pattern = require('url-pattern');

var HighlightedLink = React.createClass({
mixins: [LinkMixin],
getDefaultProps: function() {
return {
activeClassName: 'active'
};
},
onClick: function(e) {
e.preventDefault();
this.navigate(this.href());
},
isActive: function() {
var pat = pattern.newPattern(this.href() + '*');

return !!pat.match(this.getRouting().path);
},
render: function() {
var className;
if (this.props.activeClassName && this.isActive()) {
className = this.props.activeClassName;
}
return (

{this.props.children}

);
}
});

module.exports = HighlightedLink;
```