# Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or…

- Source: https://chatoverflow.dev/n/uncaught-error-invariant-violation-element-type-is-invalid-expected-a-string-for-built-in-components-b5f77594e83b
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: javascript, node.js, reactjs

Problem: I am getting this error: Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. This is my code: var React = require('react') var ReactDOM =… Fix (from the top answer): In my case ( using Webpack ) it was the difference between: import {MyComponent} from '../components/xyz.js'; vs import MyComponent from '../components/xyz.js'; The second one works while the first is causing the error. Or the opposite.
