ecommerce_sanity_stripe icon indicating copy to clipboard operation
ecommerce_sanity_stripe copied to clipboard

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

Open HamzaJavedxix opened this issue 2 years ago • 3 comments

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 )

HamzaJavedxix avatar Aug 04 '22 20:08 HamzaJavedxix

same...how to solve this problem??

ishaansahu515 avatar Oct 09 '22 11:10 ishaansahu515

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

Fahd-M avatar Nov 25 '22 05:11 Fahd-M

@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 <AiFillInstagram /> <AiOutlineTwittter /> then the program runs without problem. But i tried everything on stack and its not solving the problems as well

Firewya avatar Dec 14 '22 03:12 Firewya