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.


Getting following error after migrating to material-ui 1.0

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.

4 Answers

6 years ago by

There was a problem with my imports.
I was using the following

import { ListItem, ListItemIcon, ListItemText } from '@material-ui/core/List';

Which need to be updated to

import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
6 years ago by Karthik Divi

 import {
ListItem,
ListItemIcon,
ListItemText } from '@material-ui/core';

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

3 years ago by Usama Juttz

import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';

2 years ago by amaan