Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown.Item with NavLink #144

Open
redxzeta opened this issue Jun 26, 2022 · 3 comments
Open

Dropdown.Item with NavLink #144

redxzeta opened this issue Jun 26, 2022 · 3 comments

Comments

@redxzeta
Copy link
Contributor

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>
@benjitrosch
Copy link
Collaborator

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!

@Klaas058
Copy link
Contributor

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?

@dev0T
Copy link
Contributor

dev0T commented Apr 5, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants