简体   繁体   中英

activeClassName not working for react router for variable path

 <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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM