我正在关注this video以在ReactJS中使用Material UI。在视频中的31:28,我添加:
<Drawer open={this.state.open}>
<MenuItem>Menu Item</MenuItem>
<MenuItem>Menu Item 2</MenuItem>
</Drawer>
我遇到了这个问题:
元素ref被指定为字符串(clickAwayableElement)但没有 老板定了。您可能已经加载了多个React副本。
答案 0 :(得分:4)
我在React遇到了同样的问题。 这是我的create-react-app。
├─node_modules
├─public
└─src
├─component
│ └─react-bash
│ └─node_modules
└─lib
只需要One / node_modules依赖项。 但我在/ src下有其他/ node_modules依赖项。 我删除了/ src下的/ node_modules依赖项,这个问题就解决了。
├─node_modules
├─public
└─src
├─component
│ └─react-bash
└─lib
答案 1 :(得分:1)
我在使用react-bootstrap时遇到了同样的问题。如it's getting started page所述,我在安装react-bootstrap之前安装了“react react-dom”软件包,而我已经在create-react-app中安装了它。
卸载它解决了我
npm uninstall react react-dom