question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created a year ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Coala1010commented, Sep 14, 2022

Array.from(state.collection)

I resolve the problem like above

Thank you

0reactions
reidbarbercommented, Sep 14, 2022

I just noticed you were targeting ES5, and spread syntax is ES6. Glad you found the solution!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found