Skip to content

Commit

Permalink
Merge branch 'cwbuecheler-develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
taion committed Oct 28, 2015
2 parents dfe8c44 + d1306b1 commit d95c428
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/LinkContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ export default class LinkContainer extends React.Component {
delete props.state;

props.onClick = this.onClick;
props.href = history.createHref(to, query);
if (hash) {
props.href += hash;

// Ignore if rendered outside the context of history, simplifies unit testing.
if (history) {
props.href = history.createHref(to, query);

if (hash) {
props.href += hash;
}

props.active = history.isActive(to, query, onlyActiveOnIndex);
}
props.active = history.isActive(to, query, onlyActiveOnIndex);

return React.cloneElement(React.Children.only(children), props);
}
Expand All @@ -53,7 +59,7 @@ LinkContainer.propTypes = {
};

LinkContainer.contextTypes = {
history: React.PropTypes.object.isRequired
history: React.PropTypes.object
};

LinkContainer.defaultProps = {
Expand Down

0 comments on commit d95c428

Please sign in to comment.