【发布时间】:2020-07-16 13:11:25
【问题描述】:
我创建了非常简单的自定义组件MuiMenu 和MuiMenuItem。但是当我尝试显示这些组件时,我看到如下所示的错误:
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)`.
但如果我直接从@material-ui/core 导入 - 一切都很好。我该如何解决这个问题?
工作示例: https://codesandbox.io/s/sharp-shadow-bt404?file=/src/App.js
【问题讨论】:
标签: reactjs material-ui