activeClassName not working for react router for variable path

Viewed 89
 <li className="nav-item">
  <NavLink className="nav-link" to={"/QaManagement" + domainName}>
        <span className="Qimg" onClick={this.clicked}>
           <img src={imageVar.QA} alt="" />
        </span>
  </NavLink>
</li>

I want to change the image when the link is active, I can not use the exact property also as a domainName is a variable.

1 Answers

I am facing the same issue using activeClassName with exact property and activeClassName="active" with onlyActiveOnIndex attribute and it worked for me

Related