1

I have a list of link-elements, the clicked link-element shall have another background-color. What is the best way to achieve that in react.js ?

 render() {
   return (
        <div>
          <Link></Link>
          <Link></Link>
  ....
vuvu
  • 4,886
  • 12
  • 50
  • 73
  • Possible duplicate of [Is there a way using React Router to set an active class on the wrapper to the Link?](http://stackoverflow.com/questions/34418254/is-there-a-way-using-react-router-to-set-an-active-class-on-the-wrapper-to-the-l) – The Reason Nov 28 '16 at 16:11

1 Answers1

2

You should simply be able to apply the acctiveClassName attribute to the Link like so

<Link to="/about" activeClassName="active">About</Link>

see this link for more info.

Chaim Friedman
  • 6,124
  • 4
  • 33
  • 61