reactjs - 无法读取 t.isMuiElement 处未定义的属性 'muiName'?

标签 reactjs dialog material-ui

用chrome浏览时遇到这个问题。

Uncaught TypeError: Cannot read property 'muiName' of undefined at t.isMuiElement (reactHelpers.js:31) 
当我使用 <List> <ListItem><DialogContent>显示该错误。
<DialogContent> 
  <List>
     <ListItem> <ListItemText primary='Minimum booking notice: 24 hours in advance' /> </ListItem>            
     <ListItem> <ListItemText primary='Tour costs: Tour costs and what inclusion or exclusion is listed on the itinerary for each tour. No refunds will be given for unutilized services.'/></ListItem>
   </List>
</DialogContent>
解决办法是什么?

最佳答案

我意识到使用 muiName
What is the muiName property and when do I have to set it for Material-UI components?

const DialogContentList = (props) => (
  <List>
  <ListItem> 
    <ListItemText primary='Minimum booking notice: 24 hours in advance' />
  </ListItem> 
  </List>
);
DialogContentList.muiName = 'IconMenu';
class Footer extends Component {
      constructor(props) {
        super(props);
        this.state= {
          open: false
        }     
      }
      render() {
<DialogContentList />
      }
    }
    export default withMobileDialog()(withStyles(styles)(Footer));

我找到了问题的原因。以前我用过material-ui已弃用 .so 使用 material-ui/core/而不是它。
在我使用之前
import List, { ListItem, ListItemText } from '@material-ui/core/List';现在我用这个
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem'; 
import ListItemText from '@material-ui/core/ListItemText'; 

我的问题 已解决 .

关于reactjs - 无法读取 t.isMuiElement 处未定义的属性 'muiName'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53445921/

相关文章:

javascript - 使用 SSR 支持根据断点更改 Prop

javascript - 从 React JS 中的输入字段获取值

javascript - React 组件在浏览器中正确呈现,但呈现 : "Only a ReactOwner can have refs" 时 Jest 测试错误

javascript - 如何在 Firefox 中为 svg 的文本元素导入自定义字体?

Delphi TFontDialog - 如何缩放高 Dpi?

java - DialogFragment 中的 getContentResolver() 和 getWindow()

javascript - 在单页应用程序上使用 json 数据的material-ui

javascript - 如何向 React 的 props 添加数据

Android ListView如何禁用多点击

reactjs - 如何覆盖自定义 Material UI Accordion 的样式(分隔线和折叠图标)