How do I apply NavLink's behavior to a custom element? #11531
Unanswered
jimmycuadra
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to combine Mantine's NavLink with React Router's NavLink. I want the styling of Mantine's component but with the client-side routing behavior and active state features of React Router's component.
I tried using React Router's component as the value for Mantine's NavLink's
component
prop, but this makes all the Mantine styling disappear. As far as I can tell, React Router doesn't have similar functionality for allowing another component to do the actual rendering so that I could try doing the inverse.I'm currently working around this by using the
useNavigate
hook to manually attach client side routing behavior to the Mantine component, and theuseMatch
hook to manually implement the active state logic. Here's my naive implementation:Is there a cleaner way to do this?
Beta Was this translation helpful? Give feedback.
All reactions