September 2018
Beginner
156 pages
3h 28m
English
By default, the class name active is applied to the active <NavLink> component. For example, when a <NavLink> is clicked and the corresponding route is rendered, the selected <NavLink> has its class name set to active. To change this class name, specify the activeClassName prop on the <NavLink> component with its value set as the CSS class name that you want to apply:
<nav> <NavLink to="/">Home</NavLink> <NavLink to="/dashboard" activeClassName="selectedLink"> Dashboard </NavLink></nav>
The next step is to specify the styles for the CSS class selectedLink in your application's CSS file. Note that the first <NavLink> does not specify the activeClassName prop. In this case, when the <NavLink> is clicked, the active
Read now
Unlock full access