Style a Link that is Active with NavLink in React Router v4

InstructorJoe Maddalone

Share this video with your friends

Send Tweet

We often need to be able to apply style to navigation links based on the current route. In React Router v4 you can easily accomplish this with the NavLink component. In this lesson, we will step through three ways to accomplish styling links through the use of an active class with the NavLink component.

Sen P
~ 7 years ago

I am using the latest version of the router. The active link is automatically highlighted based on the style a.active, no need to add activeClassName="active".