React - SideNav - How to close SideNav after selecting an Si


Topic: React - SideNav - How to close SideNav after selecting an SideNavLink

explorest pro asked 7 years ago

Hi Supporter, I am using SideNav with react - I would like to close the SideNav after user select a SideNavLink or SideNavItem, How should I do that. I could not find a way to do it so far. Thanks, Long Cao

Jakub Strebeyko staff answered 7 years ago

Hi Long Cao, Welcome to the Support Board! Whether SideNav is open depends on the isOpen prop it receives (from this.state or elsewhere). The easiest thing to do would be to attach a click event listener to SideNavLinks with a callback to a function that causes the change of the prop (say, a this.setState kind of change). Hope you find this information useful. With Best Regards, Kuba

explorest pro commented 7 years ago

I got it, let me try that solution Many thanks.

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB React
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No