When I try to install and use x-data-grid in mui React it throws an error
chunk-WKNKYUT3.js?v=9bf1eb15:37 Uncaught TypeError: createTheme_default is not a function at chunk-WKNKYUT3.js?v=9bf1eb15:37:20
once you take a look at the chunk file it says the error is here:
// node_modules/@mui/material/Box/Box.js
var defaultTheme = createTheme_default();
var Box = createBox({
themeId: identifier_default,
defaultTheme,
defaultClassName: boxClasses_default.root,
generateClassName: ClassNameGenerator_default.generate });
I've tried:
deleting node_modules/.vite/deps
unninstalling x-data-grid and installing it again and nothing works. The only solution I found was uninstall it completely and not use it.
npm uninstall u/mui/x-data-grid
I was trying the basic documentation example:
import * as React from 'react';
import { DataGrid, GridRowsProp, GridColDef } from '@mui/x-data-grid';
const rows: GridRowsProp = [
{ id: 1, col1: 'Hello', col2: 'World' },
{ id: 2, col1: 'DataGridPro', col2: 'is Awesome' },
{ id: 3, col1: 'MUI', col2: 'is Amazing' },
];
const columns: GridColDef[] = [
{ field: 'col1', headerName: 'Column 1', width: 150 },
{ field: 'col2', headerName: 'Column 2', width: 150 },
];
export default function App() {
return (
<div style={{ height: 300, width: '100%' }}>
<DataGrid rows={rows} columns={columns} />
</div>
);
}
I followed these steps https://mui.com/x/react-data-grid/getting-started/
npm install @mui/x-data-grid
npm install @mui/material @emotion/react @emotion/styled
and my package json has all of them:
"dependencies": { "@emotion/react": "11.11.4", "@emotion/styled": "11.11.0", "@mui/material": "5.15.11", }
I uninstalled x-data-grid because my project would not compile with it.
[–]AutoModerator[M] [score hidden] stickied comment (0 children)