vuvu vuvu - 2 years ago 164
React JSX Question

How to highlight active link-element in react js?

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 (

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download