useMenuItem onAction & onClose deprecation confusion #3946
-
The onAction and onClose properties on the useMenuItem appear to be deprecated. On closer inspection of the useMenu tailwind demo in the docs and react spectrum itself, both still use these callbacks. The comment to "pass to the menu instead" associated with both callbacks in the absence of an up to date demo is no help at all. Does anyone have a working demo of a useMenu that 'passes these callbacks' to the menu? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The example is basically the same, there's just no need to pass down onClose and onAction to useMenuItem since they're handled by useMenu: https://codesandbox.io/s/menu-with-react-aria-tailwind-css-e57rq2?file=/src/App.tsx The examples in the docs also do this: https://react-spectrum.adobe.com/react-aria/useMenu.html#dynamic-collections |
Beta Was this translation helpful? Give feedback.
The example is basically the same, there's just no need to pass down onClose and onAction to useMenuItem since they're handled by useMenu: https://codesandbox.io/s/menu-with-react-aria-tailwind-css-e57rq2?file=/src/App.tsx
The examples in the docs also do this: https://react-spectrum.adobe.com/react-aria/useMenu.html#dynamic-collections