I run the sample code of useMenu, it is not working
See original GitHub issue🐛 Bug Report
My React version is v18.2.0
🤔 Expected Behavior
useMenu sample code should work
😯 Current Behavior
I checked the Menu.js file of sample code from useMenu
there is code like [...state.collection]
it cannot get correct array
I tried it on other project (React version is 17.0.2) It worked well
💁 Possible Solution
🔦 Context
💻 Code Sample
🌍 Your Environment
| Software | Version(s) |
|---|---|
| react-stately | 3.15.0 |
| react-aria | 3.19.0 |
| Browser | Chrome |
| Operating System | Windows |
🧢 Your Company/Team
🕷 Tracking Issue (optional)
Issue Analytics
- State:
- Created a year ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
useMenu – React Aria - React Spectrum Libraries
Documentation for useMenu in the React Aria package.
Read more >use-menu-hook - npm
Start using use-menu-hook in your project by running `npm i use-menu-hook`. There are no other projects in the npm registry using use-menu-hook.
Read more >react native - How to test components with menu
I tried to use <Menu opened={true}>...</Menu> but the result was the same. For example, this code will produce a snapshot not containing foo...
Read more >How to Use Menus - Creating a GUI With Swing
Because this code has no event handling, the menus do nothing useful except to look as they should. If you run the example,...
Read more >Menus - Android Developers
Actions in a popup menu should not directly affect the ... Instead of building a menu in your activity's code, you should define...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Array.from(state.collection)I resolve the problem like above
Thank you
I just noticed you were targeting ES5, and spread syntax is ES6. Glad you found the solution!