Mohammad Zubair
Mohammad Zubair

Reputation: 413

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.

Upvotes: 5

Views: 109

Answers (1)

michael
michael

Reputation: 56

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

Upvotes: 1

Related Questions