Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
React Router NavLink with inactiveClassName and isActive child function enhancements
@JofArnold

This comment has been minimized.

Copy link
Owner Author

JofArnold commented Feb 1, 2018

Example use:

<NavLink {...someProps} inactiveClassName="blue" activeClassName="red">
  {({ isActive }) =>
    isActive ? <span>Active :)</span> : <span>Inactive :(</span>}
</NavLink>;

Probably needs the same for style attribute too, for completeness, but I'll leave that as a lesson for the reader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.