Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. #67

Open
andremiracle opened this issue Sep 20, 2022 · 2 comments

Comments

@andremiracle
Copy link

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.

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
ReactDOMServerRenderer.render
file:///C:/Users/Amarachukwu/Desktop/Levi/my%20projects/E-commerce/e-commerce/node_modules/react-dom/cjs/react-dom-server.node.development.js (4053:17)
ReactDOMServerRenderer.read
file:///C:/Users/Amarachukwu/Desktop/Levi/my%20projects/E-commerce/e-commerce/node_modules/react-dom/cjs/react-dom-server.node.development.js (3690:29)
Object.renderToString
file:///C:/Users/Amarachukwu/Desktop/Levi/my%20projects/E-commerce/e-commerce/node_modules/react-dom/cjs/react-dom-server.node.development.js (4298:27)
Object.renderPage
file:///C:/Users/Amarachukwu/Desktop/Levi/my%20projects/E-commerce/e-commerce/node_modules/next/dist/server/render.js (751:45)
Object.defaultGetInitialProps
file:///C:/Users/Amarachukwu/Desktop/Levi/my%20projects/E-commerce/e-commerce/node_modules/next/dist/server/render.js (389:51)
Function.getInitialProps
node_modules\next\dist\pages_document.js (145:19)
Object.loadGetInitialProps
file:///C:/Users/Amarachukwu/Desktop/Levi/my%20projects/E-commerce/e-commerce/node_modules/next/dist/shared/lib/utils.js (69:29)
renderDocument
file:///C:/Users/Amarachukwu/Desktop/Levi/my%20projects/E-commerce/e-commerce/node_modules/next/dist/server/render.js (764:48)
Object.renderToHTML
file:///C:/Users/Amarachukwu/Desktop/Levi/my%20projects/E-commerce/e-commerce/node_modules/next/dist/server/render.js (828:34)
runMicrotasks

@steisaden
Copy link

I had the same error and was able to fix it by correcting my import module at the top of the file.

@muskan-Bansal
Copy link

try this in the StateContext.js file

const Context = createContext({});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants