Reputation: 5328
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>
....
Upvotes: 1
Views: 6685
Reputation: 6253
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.
Upvotes: 2