用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/