Next.js Discord

Discord Forum

In next 14 Got error: Element type is invalid: expected a string or a class/function but got obj

Unanswered
Rough harvester ant posted this in #help-forum
Open in Discord
Rough harvester antOP
Currently i am working on a project which is build on next 14.2.1, and with mui ^5.15.13, currently all components in it are "use client", even
import { Box } from '@mui/material';

export default function Dashboard() {
  return (
    <>
      <h1>Hello</h1>
      <Box sx={{ backgroundColor: 'primary.main', padding: 16 }}>Hello</Box>
    </>
  );
}

was having "use client "(this is an eg), I wanted to make it server side by removing use client, but got "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 searched for it a lot , but got nothing, even tried to
import react at top
, also tried
import Box from '@mui/material/Box';
. Please help me.

0 Replies