MenuItem cannot be rendered outside a collection. #7020
Answered
by
NickWoodward
NickWoodward
asked this question in
Q&A
-
I'm trying to implement the menu example, here: https://react-spectrum.adobe.com/react-aria/Menu.html#example
And I'm not entirely sure why? Isn't a
|
Beta Was this translation helpful? Give feedback.
Answered by
NickWoodward
Sep 11, 2024
Replies: 1 comment 3 replies
-
Might have duplicate copies of some of our packages? Can you reproduce it in a codesandbox or stackblitz? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
:)
Your questions made me notice the problem, thanks! The code works fine inside a React component, but not nested as children in an
.astro
file like that. So yes, you're right, it was restrictions on the layout (or more specifically the astro file).Other answers: Context - no, useEffect -no, client:load yes, it's needed to provide interactivity.
Here's it working if you're interested: https://stackblitz.com/edit/withastro-astro-xkekzy?file=src%2Flayouts%2FLayout.astro
Thanks again!