Topic: Opening a collapsed navigation section from an external button
Chloe Adams
free
asked 1 week ago
A separate action should open the mobile navigation. Its state becomes true, yet the menu remains hidden with the standard stylesheet.
How should that state reach MDBCollapse?
Mateusz Lazaru
staff
answered 1 week ago
Keep the navigation's open state in a shared parent and pass that boolean to the MDBCollapse open prop. Your external button should update that same state; the button does not need to live inside the navbar. A second local state variable inside a navigation wrapper can leave the collapse reading an unchanged value.
Please provide the parent, external button, and collapse JSX if this still fails. Include the actual prop received by MDBCollapse when the button is clicked, plus any wrapper that copies props into its own state.
https://mdbootstrap.com/docs/react/navigation/navbar/
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB React
- MDB Version: MDB5 9.0.0
- Device: Laptop
- Browser: Edge
- OS: Windows 11
- Provided sample code: No
- Provided link: No