Currently I am working on a project which is built on Next.js 14.2.1, and with MUI ^5.15.13, currently all components in it are “use client”.
I have created another small component (server side) like
import { Box } from '@mui/material';
export default function Dashboard() {
return (
<>
<h1>Hello</h1>
<Box sx={{ backgroundColor: 'primary.main', padding: 16 }}>Hello</Box>
</>
);
}
I am getting
“Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.”
after build
I have done everything that I have found,
imported React with
import React from 'react';
Also
tried
import Box from '@mui/material/Box';
But still got this error. Can you please help me?