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

Error when using menu and listbox with child function and fragment in React 19 #3597

Open
isoroka-plana opened this issue Dec 16, 2024 · 0 comments

Comments

@isoroka-plana
Copy link

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

For example: v2.2.0

What browser are you using?

For example: Chrome

Reproduction URL

https://codesandbox.io/p/devbox/funny-wood-jtchxm

Describe your issue

After updating to React 19 following error has begun to appear in my console:

 Invalid prop `data-headlessui-state` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props. 

When direct child of Menu or Listbox elements is a react fragment (my use case is that I am using a function a function for children to access the component's APIs).
Example:

<Menu>
  ({open}) => (
    <>
      <MenuButton>Text</MenuButton>
      {open && <MenuItems></MenuItems}
    </>
  )
</Menu>

There may be other components affected, I did not test.

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

1 participant