I'm making a website where I'm using react-router-dom's NavLink components to prevent rerenders for a single page application experience.
As I am trying to make the site responsive, I have been trying to make the responsive navbar from react-bootstrap collapse after selecting a NavLink, but the collapseOnSelect behaviour doesn't seem to work for anything other than the Nav.Link components that come with react-bootstrap.
Other solutions have recommended passing down props to the nav (navExpanded:true) with manual toggle functions etc, but this seems to still force a rerender due to the state change. The main reason I want to avoid this is because I have made transitions between pages using react-transitions-group.
<Navbar collapseOnSelect expand="md" variant="dark">
<Container>
<Navbar.Brand href="/"><Logo/></Navbar.Brand>
<Navbar.Toggle aria-controls="responsive-navbar-nav" />
<Navbar.Collapse id="responsive-navbar-nav">
<Nav className="Navs ml-auto">
<NavLink className="nav-link" to="/about">ABOUT</NavLink>
<NavLink className="nav-link" to="/portfolio">PORTFOLIO</NavLink>
<NavLink className="nav-link" to="/contact">CONTACT</NavLink>
</Nav>
</Navbar.Collapse>
</Container>
</Navbar>
Any help would be greatly appreciated!