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

🐛 Menu causes react error: Warning: A props object containing a "key" prop is being spread into JSX: #1237

Open
Suhaibinator opened this issue Sep 11, 2024 · 0 comments
Labels

Comments

@Suhaibinator
Copy link

The following error is thrown when a basic menu is used (the exact menu copied and pasted from the example in fact)

Describe the bug

index.tsx:86 Warning: A props object containing a "key" prop is being spread into JSX: let props = {key: someKey, id: ..., item: ..., ref: ..., children: ...}; <ForwardRef {...props} /> React keys must be passed directly to JSX without using spread: let props = {id: ..., item: ..., ref: ..., children: ...}; <ForwardRef key={someKey} {...props} /> at InnerMenu (http://localhost:3000/static/js/bundle.js:20879:21) at div at http://localhost:3000/static/js/bundle.js:13419:81 at InnerBox (http://localhost:3000/static/js/bundle.js:7610:122) at BreakpointProvider (http://localhost:3000/static/js/bundle.js:27647:3) at InnerThemeProvider (http://localhost:3000/static/js/bundle.js:28549:7) at div at http://localhost:3000/static/js/bundle.js:13419:81 at InnerBox (http://localhost:3000/static/js/bundle.js:7610:122) at InnerTransition (http://localhost:3000/static/js/bundle.js:32531:7) at InnerOverlay (http://localhost:3000/static/js/bundle.js:22401:7) at InnerMenuTrigger (http://localhost:3000/static/js/bundle.js:21366:102) at div at http://localhost:3000/static/js/bundle.js:13419:81 at InnerBox (http://localhost:3000/static/js/bundle.js:7610:122) at InnerFlex (http://localhost:3000/static/js/bundle.js:19134:93)

Steps to reproduce

Simply trying to render the following causes the error
<Flex> <MenuTrigger> <IconButton variant="secondary" aria-label="View tasks"> <VerticalDotsMajorIcon /> </IconButton> <Menu> <Item key="launch">Launch...</Item> <Item key="eject">Eject...</Item> <Item key="land">Land...</Item> <Item key="help">Help</Item> <Item key="exit">Exit</Item> </Menu> </MenuTrigger> </Flex>

Expected results

No console warning

Reproducible demo

Simply using this will cause the error:

<Flex> <MenuTrigger> <IconButton variant="secondary" aria-label="View tasks"> <VerticalDotsMajorIcon /> </IconButton> <Menu> <Item key="launch">Launch...</Item> <Item key="eject">Eject...</Item> <Item key="land">Land...</Item> <Item key="help">Help</Item> <Item key="exit">Exit</Item> </Menu> </MenuTrigger> </Flex>

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

No branches or pull requests

1 participant