Next.js 15: Element type is invalid — expected a string or class/function but got: object
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Check the render method of `Home`.
Immediate Remediation
bash
grep -rn "export default" src/app/page.tsx && grep -rn "export const Home" src/app/page.tsx || echo "Fix: change 'export const Home' to 'export default Home' in src/app/page.tsx"
Root Cause Analysis
The page or component file exports a named object (e.g. `export const Home = {}`) instead of a React component, or the import statement pulls in the module namespace object rather than the default export, causing React to receive an object where it expects a component type.
Verification & Guardrails
- Verify the component is defined as a function or class, not an object literal.
- If using named exports, ensure the import uses braces: `import { Home } from './Home'`.
- Check for circular imports that may cause the component to be undefined at render time.
Have a custom or uncategorized crash?
Run your trace through our in-memory client privacy sandbox for instant SRE remediation.