Closed
Description
Took me a while to figure this one out. For some strange reason, when I use connect to decorate my component, <LinkContainer>
stops marking links as active. If I remove the connect()(Header)
call, <LinkContainer>
works as expected.
import React from 'react'
import { connect } from 'react-redux'
import { LinkContainer } from 'react-router-bootstrap'
import {
Nav,
Navbar,
NavItem,
} from 'react-bootstrap'
class Header extends React.Component {
render() {
return (
<div>
<Navbar>
<Navbar.Collapse>
<Nav pullLeft>
<LinkContainer to="/dashboard/registrations">
<NavItem>
Registrations
</NavItem>
</LinkContainer>
<LinkContainer to="/dashboard/monitoring">
<NavItem>
Monitoring
</NavItem>
</LinkContainer>
</Nav>
</Navbar.Collapse>
</Navbar>
</div>
)
}
}
export default Header
/*
When using connect(), LinkContainer stops working and
links are no longer marked as active when URL changes
*/
// export default connect()(Header)
Here's the behaviour I get when using connect:
Thinks those are related but I can't figure out a quick/official fix:
Metadata
Metadata
Assignees
Labels
No labels