react-daisyui
react-daisyui copied to clipboard
Dropdown.Item with NavLink
Using NavLink
from react-router-dom
with <DropDown.Item>
, I would get this in the console
<a> cannot appear as a descendant of <a>.
Wondering if there's a way to use NavLink
and DropDown.Item
Workaround:
<li>
<NavLink to={route}>{name}</NavLink>
</li>
Ah, yeah that will be a problem since the DropdownItem renders an anchor. Let me see what I can do about that, and post a PR here!
The workaround you mentioned sounds like a viable solution to me.
The Daisyui docs for the dropdown shows the usage of the li><a>Item 1</a></li>
strategy.
The only thing react-daisyui
does is wrapping that and exposing it as the Dropdown.Item static.
My suggestion would be to leave it as is and maybe have an example story about it.
What do y'all think?
Wouldn't a polymorphic prop be ideal in this case?
Edit: Sorry, I just realized this has already been mentioned in #129 and #108. I believe these 3 issues are related and could be solved if such a prop would be implemented. I can take a look into this and see if I can come up with a solution. Would that be okay? @benjitrosch