🐛 Issue with SelectTrigger and asChild: React.Children.only error #7357
Unanswered
luisemaltez
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there, I'm running into an issue using SelectTrigger with the asChild prop. Even in simple implementations like the one below, I get the following error:
Here’s a minimal reproduction:
💡 Temporary Fix
To get around the error, I updated the SelectTrigger component like so:
This bypasses the issue by manually checking for the asChild prop and rendering appropriately.
Any insight into whether this is the intended behavior or if there’s a better pattern to handle asChild here would be greatly appreciated!
Many thanks 🙌
Beta Was this translation helpful? Give feedback.
All reactions