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.

Next.js · updated 2026-11-04

Thrown by React when it renders <Something /> and Something is not a component: undefined, an object (a module namespace) or another value. React adds "Check the render method of `Parent`" with the component that rendered it. In production it's Minified React error #130.

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.

Check the render method of `OrderPage`.

Quick fix

Go to the component named in "Check the render method of" and look at each JSX tag's import. Match the import to the export: export default function Card → import Card from './card'; export function Card → import { Card } from './card'. For a library, check that the component exists under that name and path in the installed version.

  1. Open the parent component named in "Check the render method of …".
  2. For each custom tag in it, compare the import line with how that file exports the component (default or named).
  3. Fix the import, or add the missing export.
  4. For library components, check the installed version exports that name (an upgrade may have renamed or moved it).
  5. If it is undefined only sometimes, look for a circular import between the two files.
typescript
// components/order-card.tsx
export function OrderCard() { /* ... */ }   // named export

// app/orders/page.tsx
// import OrderCard from '@/components/order-card';   // default import: undefined
import { OrderCard } from '@/components/order-card';  // matches the named export

export default function OrderPage() {
  return <OrderCard />;
}

Why it happens

Default vs named import

import X from when the file uses export function X (or the reverse) gives undefined; the most common cause by far.

The component is not exported

The function exists in the file but has no export, or was renamed in the file and not in the import.

A library changed its exports

After an upgrade, a component moved to another path or became a named export (icon packs and UI kits do this often).

got: object

A namespace import (import * as Card) or a CommonJS module rendered as a component gives "but got: object" instead of undefined.

Other fixes

  • In production, Minified React error #130 links to react.dev/errors/130 with the same got: value.
  • TypeScript reports the bad import at build time ("has no default export") if the file is type-checked, so this mostly slips through in JavaScript files or with any.

Same error, other wording

  • Error: Minified React error #130; visit https://react.dev/errors/130?args[]=undefined&args[]= for the full message
  • Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
  • Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

Let your coding agent catch the next one

Runheed records this error in production with the stack trace, the breadcrumbs before it and the agent session that shipped the code, and serves it to Claude Code, Cursor or any MCP client. With it connected, you can ask:

> Find the "Element type is invalid" (Minified React error #130) errors, open the component named in "Check the render method of", and fix the import that resolves to undefined so it matches how the component is exported.

Plans from $29/moSee what your agent readsSee the setupCancel any time from the billing portal

Related errors

More in React and Next.js rendering

References: React docs: error #130, React docs: importing and exporting components