Dynamically add 'active' prop in MDB Bootstrap Rea


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

Raghav Sharma asked 5 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 5 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

Open

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.26.1
  • Device: Macbook
  • Browser: Google Chrome
  • OS: Mac OS Catalina
  • Provided sample code: No
  • Provided link: Yes
Tags