'How to fix React forwardRef(Menu) Material UI?

I created very simple custom components MuiMenu and MuiMenuItem. But when I try displaying these components I see an error as shown below:

Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

Check the render method of `ForwardRef(Menu)`.

But if I import directly from @material-ui/core - all is well. How do I fix this?

Working example: https://codesandbox.io/s/sharp-shadow-bt404?file=/src/App.js



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source