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.

173622


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

5 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';
5 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.

2 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';

1 year ago by amaan