DEV Community

dayo adeniji
dayo adeniji

Posted on

_document.js error from ctx.renderPage().

Hi,
While trying to apply Material-ui styles into a Next app, I am getting error from the _document.js file, in the ctx.renderPage( ) function
Below is error log output-
----->
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

The error results from this function -->
ctx.renderPage = () =>
originalRenderPage({
enhanceApp: (App) =>
function EnhanceApp(props) {
return ;
},

I would grateful for all useful advice
Thanks

Top comments (1)

Collapse
 
xkoredeus profile image
Sergey Nacharov

Hello there!

  1. Check imports in your app (components, pages). They should be named.
  2. Try to import head from 'next/head'.