Topic: MDBReact - SideNavCat - how to make onClick handler work?
tomasz1253
pro premium asked 3 years ago
<SideNavCat id="instruction-cat" name="Instruction" icon="hand-pointer-o" href="#">
<SideNavLink>For bloggers</SideNavLink>
<SideNavLink>For authors</SideNavLink>
</SideNavCat>
I want to add onClick handler, (example below) to SideNavCat but its not even triggered :/
<SideNavCat onClick={this.exampleFunction} id="instruction-cat" name="Instruction" icon="hand-pointer-o" href="#">
<SideNavLink>For bloggers</SideNavLink>
<SideNavLink>For authors</SideNavLink>
</SideNavCat>
When I'm clicking on SideNavCat this.exampleFunction is not being fired. How to fire onClick before SideNavLinks inside SideNavCat appear?
I also find out that the same goes for SideNavLink onClick handler on SideNavLinks doesnt work. How can I make it work also for SideNavLinks?
Jakub Mandra
staff premium answered 3 years ago
<SideNavLink to="/route4">Link</SideNavLink>
<SideNavItem onClick={this.sideNavItemClick}>Instruction</SideNavItem>
Jakub Mandra
staff premium answered 3 years ago
tomasz1253 pro premium commented 3 years ago
I want to change component State in which SideNav is. For example calculate something and show in diffrent component. Is it possible to fire some kind of Event from them? If not - then how to change route or/and (if possible) hash value? Will it be possible in future releases? Best, TomekResolved
- User: Pro
- Premium support: No
- Technology: React
- MDB Version: 4.7.0
- Device: Any
- Browser: Any
- OS: Any
- Provided sample code: No
- Provided link: No