Skip to content

Commit

Permalink
Fixes activation of navlinks
Browse files Browse the repository at this point in the history
There is some problem with the combination of react-router
and react-bootstrap that causes a single nav link, e.g. users or
subs, to be stuck activated regardless of the actual current url.

I found a fix here
remix-run/react-router#3536
and an explanation here
https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/guides/blocked-updates.md
  • Loading branch information
cdunn6754 committed Nov 7, 2018
1 parent adf7226 commit dc03274
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/NavBar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ const NavBar = (props) => {
</NavDropdown>

<LinkContainer exact to="/users">
<NavItem eventKey={1}>Users</NavItem>
<NavItem>Users</NavItem>
</LinkContainer>
<LinkContainer exact to="/subs">
<NavItem eventKey={2}>Subs</NavItem>
<NavItem>Subs</NavItem>
</LinkContainer>
</Nav>
<Nav pullRight className="right-user-links">
Expand Down
2 changes: 2 additions & 0 deletions src/containers/NavBarContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const mapDispatchToProps = dispatch => (
const NavBarContainer = connect(
null,
mapDispatchToProps,
null,
{pure: false},
)(NavBar)

export default NavBarContainer;
Expand Down

0 comments on commit dc03274

Please sign in to comment.