Javascript 材料界面<;表/>;抛出的元素类型无效

Javascript 材料界面<;表/>;抛出的元素类型无效,javascript,reactjs,material-ui,jsx,Javascript,Reactjs,Material Ui,Jsx,我很难使用MaterialUI表(我在以前的项目中使用了十几次) 我目前正在使用@materialui/core@3.5.1,我还尝试了@3.2.0和@3.6.0 我也在使用react@16.3.2和反应-dom@16.2.0 我在项目中的material ui中有一些其他组件(按钮、文本字段…),它们工作得很好,但是,当我尝试使用SimpleTable示例时,我出现以下错误: 我尝试在一个全新的项目中使用它=>它可以工作 这就是为什么我试图从一个版本切换到另一个版本,但它仍然不起作用。我不知

我很难使用MaterialUI表(我在以前的项目中使用了十几次)

我目前正在使用
@materialui/core@3.5.1
,我还尝试了
@3.2.0
@3.6.0

我也在使用
react@16.3.2
反应-dom@16.2.0

我在项目中的material ui中有一些其他组件(按钮、文本字段…),它们工作得很好,但是,当我尝试使用
SimpleTable
示例时,我出现以下错误:

我尝试在一个全新的项目中使用它=>它可以工作

这就是为什么我试图从一个版本切换到另一个版本,但它仍然不起作用。我不知道我的错误在哪里

以下是my SimpleTable组件(mui文档的完美副本/过去):

我有一些其他的页面,可以与其他材质ui组件一起使用


如果我更改SimpleTable的呈现只是为了返回一个
Hello World

,而不是整个表的内容,那么它工作正常。因此它不能来自默认导出或组件imo的全局导入。 它可能来自我的材料ui导入..但它们似乎没问题


如果有人有想法,请提供一些帮助,非常感谢这个问题似乎来自于与项目中其他地方使用的react native web的冲突


更新
react-native-web
+安装
react-art
解决了问题。

您如何使用
MyPage
?我认为这不是材质ui的问题。这只是导入/导出或声明组件的方式的问题。我编辑了我的帖子,但我使用它的方式与使用其他组件的方式完全相同。如果我更改了呈现
SimpleTable
只是为了返回一个
Hello World

而不是整个表的内容,它正在工作。因此它不能来自
组件的默认导出或全局导入
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';
import TableHead from '@material-ui/core/TableHead';
import TableRow from '@material-ui/core/TableRow';
import Paper from '@material-ui/core/Paper';

const styles = theme => ({
    root: {
        width: '100%',
        marginTop: theme.spacing.unit * 3,
        overflowX: 'auto'
    },
    table: {
        minWidth: 700
    }
});

let id = 0;
function createData(name, calories, fat, carbs, protein) {
    id += 1;
    return { id, name, calories, fat, carbs, protein };
}

const rows = [
    createData('Frozen yoghurt', 159, 6.0, 24, 4.0),
    createData('Ice cream sandwich', 237, 9.0, 37, 4.3),
    createData('Eclair', 262, 16.0, 24, 6.0),
    createData('Cupcake', 305, 3.7, 67, 4.3),
    createData('Gingerbread', 356, 16.0, 49, 3.9)
];

function SimpleTable(props) {
    const { classes } = props;

    return (
        <Paper className={classes.root}>
            <Table className={classes.table}>
                <TableHead>
                    <TableRow>
                        <TableCell>Dessert (100g serving)</TableCell>
                        <TableCell numeric>Calories</TableCell>
                        <TableCell numeric>Fat (g)</TableCell>
                        <TableCell numeric>Carbs (g)</TableCell>
                        <TableCell numeric>Protein (g)</TableCell>
                    </TableRow>
                </TableHead>
                <TableBody>
                    {rows.map(row => {
                        return (
                            <TableRow key={row.id}>
                                <TableCell component="th" scope="row">
                                    {row.name}
                                </TableCell>
                                <TableCell numeric>{row.calories}</TableCell>
                                <TableCell numeric>{row.fat}</TableCell>
                                <TableCell numeric>{row.carbs}</TableCell>
                                <TableCell numeric>{row.protein}</TableCell>
                            </TableRow>
                        );
                    })}
                </TableBody>
            </Table>
        </Paper>
    );
}

SimpleTable.propTypes = {
    classes: PropTypes.object.isRequired
};

export default withStyles(styles)(SimpleTable);
import React from 'react';
import SimpleTable from './Table';

export const MyPage = () => (
    <div>       
        <SimpleTable />
    </div>
);
 <MuiThemeProvider theme={theme}>
     <MyPage />        
 </MuiThemeProvider>