Customize root element of <NavLink>
#9024
SevenOutman
started this conversation in
Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I find it such common use case to combine
<NavLink>
with navigation components from UI libraries. Those components usually accept anactive
prop that changes their appearance, it should have been easy to integrate but it's actually not as<NavLink>
doesn't allow customize its root element.Take this
<Nav.Item>
component for example, I wish to combine it with NavLink like this:It does not work well because it renders an extra wrapping the <Nav.Item>.
What I have to do now is to query the active state manually via
useMatch
.It works but what's the point in using NavLink here then?
I think it would be great if NavLink provide an API that allow user to get rid of its default root element like
What do you folks think?
Beta Was this translation helpful? Give feedback.
All reactions