How to set activeClassName for wrapper element of Link or IndexLink in react-router?

前端 未结 10 1526
醉酒成梦
醉酒成梦 2020-12-07 15:56

I am new to the ReactJS world, and would like to know how can I pass active class name to the

  • element instead of (Link) element
  • 10条回答
    •  暗喜
      暗喜 (楼主)
      2020-12-07 16:29

      Great answer.

      Just change the following to get it working...

      LinkComponent = index ? IndexLink : Link //If its true you want an IndexLink 
      
      //Also link needs to be...
      Home
      

    提交回复
    热议问题