Topic: Dynamically add 'active' prop in MDB Bootstrap React Navbar

Raghav Sharma free asked 4 years ago


Expected behavior

How do I add the active class dyanmically i.e send via prop in mdbootstrap react navbar?

I want it to change as soon as I click on a <MDBNavitem>

<MDBNavItem active>
          <MDBNavLink to="#!">Home</MDBNavLink>
        </MDBNavItem>

Resources (screenshots, code snippets etc.)

https://mdbootstrap.com/docs/react/navigation/navbar/


Piotr Glejzer staff commented 4 years ago

You can change active with a state with conditions.

<MDBNavItem active={yourState? true : false } />



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Opened

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.26.1
  • Device: Macbook
  • Browser: Google Chrome
  • OS: Mac OS Catalina
  • Provided sample code: Yes
  • Provided link: Yes