Element type is invalid React Origin: On your device OSI layer 7 · Application Last updated 14 Oct 2026

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

JSX referenced a component that is undefined — almost always a default/named import mismatch.

Exact message you may see Element type is invalidexpected a string (for built-in components) or a class/functionbut got: undefinedbut got: object
Seen on: React

Meaning

React renders <Foo /> by calling Foo. If the import resolved to undefined (wrong export style, wrong path, circular import), React throws this error and names the parent component.

Common causes

  • import Foo from vs import { Foo } from mismatch
  • Component not exported
  • Circular import returning undefined
  • Importing from the wrong path/index file

⚡ Quick fix

  1. Check how the component is exported and match the import
  2. console.log the imported value
  3. Break circular imports

Detailed fix by platform

React

  1. jsx
    // Button.jsx: export function Button() {}
    import { Button } from './Button';

How to diagnose

  1. Component — Which render method is named?
  2. Import — Default or named export?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

declared and not used — Go: declared and not used: x / "fmt" imported and not used (Go)declared and not usedDynamic server usage — Error: Dynamic server usage: Route /x couldn't be rendered statically because it used `cookies` (React)Dynamic server usageFunctions not valid as child — Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. (React)Functions not valid a…Module not found: Can't resolve 'x' (Next.js build) — Next.js: Module not found: Can't resolve '@/components/Button' / 'lodash' in '/app/src' (Next.js)Module not found: Can…not a constructor — TypeError: x is not a constructor (JavaScript)not a constructorNothing was returned from render — Error: Nothing was returned from render. This usually means a return statement is missing. (React)Nothing was returned …Objects are not valid as a React child — Error: Objects are not valid as a React child (React)Objects are not valid…setState during render — Warning: Cannot update a component (`Parent`) while rendering a different component (`Child`) (React)setState during renderElement t…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.