我无法在 React 中记忆我的 Material UI Datagridtable
const Mockdata = [{id: 1 , user: "john",School: "LAL" },
{id: 2 , user: "Ruby",School: "LAL" }]
const column = [
{ field: "user", headerName: "Username", width: 250 },
{ field: "School", headerName: "School", width: 250 },
];
const Row = Mockdata.map((data) => ({
id: data.id,
user: data.user,
School: data.School,
}))
const MemoizedRow = React.memo(Row)
const MemoizedColumn = React.memo(column)
<DataGrid
rows={MemoizedRow}
columns={MemoizedColumn}
initialState={{
pagination: {
paginationModel: {
pageSize: 15,
},
},
}}
pageSizeOptions={[15]}
/>;
警告:备注:第一个参数必须是组件。而是收到:对象
警告:道具类型失败:提供给“ForwardRef(DataGrid)”的“对象”类型的道具“行”无效,需要一个数组。
有没有办法克服这个错误或警告?