adrianhajdin / ecommerce_sanity_stripe

Modern Full Stack ECommerce Application with Stripe
https://jsmastery.pro
2.21k stars 674 forks source link

expected a string (for built-in components) or a class/function (for composite components) but got: undefined. #52

Open HamzaJavedxix opened 2 years ago

HamzaJavedxix commented 2 years ago

after completing the Navbar.jsx at 1:13:28 in the video it shows this error Server Error 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/Hamza/Desktop/ecommerce/ecommerce/node_modules/react-dom/cjs/react-dom-server.node.development.js (4053:17) ReactDOMServerRenderer.read file:///C:/Users/Hamza/Desktop/ecommerce/ecommerce/node_modules/react-dom/cjs/react-dom-server.node.development.js (3690:29) Object.renderToString file:///C:/Users/Hamza/Desktop/ecommerce/ecommerce/node_modules/react-dom/cjs/react-dom-server.node.development.js (4298:27) Object.renderPage file:///C:/Users/Hamza/Desktop/ecommerce/ecommerce/node_modules/next/dist/server/render.js (751:45) Object.defaultGetInitialProps file:///C:/Users/Hamza/Desktop/ecommerce/ecommerce/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/Hamza/Desktop/ecommerce/ecommerce/node_modules/next/dist/shared/lib/utils.js (69:29) renderDocument file:///C:/Users/Hamza/Desktop/ecommerce/ecommerce/node_modules/next/dist/server/render.js (764:48) Object.renderToHTML file:///C:/Users/Hamza/Desktop/ecommerce/ecommerce/node_modules/next/dist/server/render.js (828:34) processTicksAndRejections node:internal/process/task_queues (96:5 1 )

ishaansahu515 commented 2 years ago

same...how to solve this problem??

Fahd-M commented 2 years ago

Have the same issue! Did anyone get a fix to this? [1:09:55] - As soon as I wrap the <Component {...pageProps} in the the error appears : 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.

StackOverflow keeps saying things about the default export but everything I have seems to be okay until I try to use the Layout component

Firewya commented 1 year ago

@HamzaJavedxix im having the same issue when implementing the footer component. It has something to do with the import of { AiFillInstagram, AiOutlineTwittter} if i comment out the then the program runs without problem. But i tried everything on stack and its not solving the problems as well