MaterialUI数据网格发出无效的挂接呼叫



我有史以来最简单的组件。我从MaterialUI导入了DataGrid,为列和行分别创建了一个变量,并在函数组件的render函数中调用了DataGrid。现在我接到一个无效的挂机呼叫。我在StackOverflow上看到过这个错误,但有些人使用了类组件。我使用的是功能组件,组件中没有其他任何东西。然而我收到了一个错误。这怎么可能?我做错了什么?

import React from 'react'
import { DataGrid } from '@material-ui/data-grid'
const columns = [
{field: 'something', headername: 'ID'},
{field: 'title', headername: 'Title', width: 300},
{field: 'body', headername: 'Body', width: 600}
]
const rows = [
{id: 1, something: 'hello', title: 'title', body: 'body'}
]
function DataTable() {
return (
<div>
<DataGrid rows={rows} columns={columns}/>
</div>
)
}
export default DataTable

我导入了错误的数据网格。

我已将导入对账单更改为从"@mui/x-DataGrid"导入{DataGrid};

此外,我安装了这个软件包,它似乎对使用materialUI至关重要。https://www.npmjs.com/package/@mui/材料?activeTab=自述

最新更新