简体   繁体   English

“ material-ui”不包含名为“ withStyles”的导出

[英]'material-ui' does not contain an export named 'withStyles'

My package.json looks like this. 我的package.json看起来像这样。 The app was working fine until a while ago suddenly i get this error. 该应用程序运行良好,直到不久前突然出现此错误。

    "@material-ui/icons": "1.0.0-beta.42",
"chartist": "0.10.1",
"classnames": "2.2.5",
"material-ui": "1.0.0-beta.41",
"npm-run-all": "4.1.2",
"perfect-scrollbar": "1.3.0",
"react": "16.2.0",
"react-chartist": "0.13.1",
"react-dom": "16.2.0",
"react-google-maps": "9.4.5",
"react-router-dom": "4.2.2",
"react-scripts": "1.0.17",
"react-swipeable-views": "0.12.12"

My component looks like this import React from "react"; 我的组件看起来像是从“ react”导入React; import { withStyles, Card, CardHeader, CardContent, CardActions, Typography } from "material-ui"; 从“ material-ui”导入{withStyles,Card,CardHeader,CardContent,CardActions,Typography}; import PropTypes from "prop-types"; 从“ prop-types”导入PropTypes;

import profileCardStyle from "assets/jss/material-dashboard-react/profileCardStyle";

function ProfileCard({ ...props }) {
const { classes, subtitle, title, description, footer, avatar } = props;
return (
<Card className={classes.card}>
<CardHeader
classes={{
root: classes.cardHeader,
avatar: classes.cardAvatar
}}
avatar={<img src={avatar} alt="..." className={classes.img} />}
/>
<CardContent className={classes.textAlign}>
{subtitle !== undefined ? (
<Typography component="h6" className={classes.cardSubtitle}>
{subtitle}
</Typography>
) : null}
{title !== undefined ? (
<Typography component="h4" className={classes.cardTitle}>
{title}
</Typography>
) : null}
{description !== undefined ? (
<Typography component="p" className={classes.cardDescription}>
{description}
</Typography>
) : null}
</CardContent>
<CardActions className={classes.textAlign + " " + classes.cardActions}>
{footer}
</CardActions>
</Card>
);
}

ProfileCard.propTypes = {
classes: PropTypes.object.isRequired,
title: PropTypes.node,
subtitle: PropTypes.node,
description: PropTypes.node,
footer: PropTypes.node,
avatar: PropTypes.string
};

export default withStyles(profileCardStyle)(ProfileCard);

您需要导入withStyles

import { withStyles } from 'material-ui/styles'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 @material-ui/core/styles 的问题:不包含名为“makeStyles”的导出 - problem with @material-ui/core/styles: does not contain an export named 'makeStyles' 在 React with Jest 中为 @material-ui withStyles 创建手动模拟 - Create manual mock for @material-ui withStyles in React with Jest 如何使用 Typescript 实现 Material-UI ThemeProvider 和 WithStyles - How to implement Material-UI ThemeProvider and WithStyles using Typescript 以嵌套方式使用material-ui v1的withStyles - Using withStyles of material-ui v1 in a nested manner 外部文件上的材质-ui withStyles无法正常工作 - React material-ui withStyles on external file not working 使用 styed-components 和 Material-UI withStyles 的 TextField 样式 - TextField Style using styed-components and Material-UI withStyles ./src/components/styles.js 尝试导入错误:&#39;@material-ui/core/styles&#39; 不包含默认导出(作为 &#39;makeStyles&#39; 导入) - ./src/components/styles.js Attempted import error: '@material-ui/core/styles' does not contain a default export (imported as 'makeStyles') 不包含名为的导出 - does not contain an export named Material-UI:WithStyles(ForwardRef(Dialog)) 中未实现提供给 classes 道具的关键 `paperFullWidth` - Material-UI: The key `paperFullWidth` provided to the classes prop is not implemented in WithStyles(ForwardRef(Dialog)) 为什么我不能将redux的connect与material-ui withStyles配合使用? - Why I can't apply redux's connect with material-ui withStyles?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM