Element type is invalid
React JavaScript Library
Severity: ModerateWhat it means
React: 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.
It may end with Check the render method of `App`, naming the component where it happened.
In a production build only the number shows: Minified React error #130.
Affected Models
- React 16.8 and later
How to Fix It
-
got: undefined? Match the import to the export. export default Button is imported as import Button from './Button'. export function Button is imported as import { Button } from './Button'.
-
Check that the file really exports the component, and that the path and spelling are right, upper and lower case included.
-
got: object? One cause is a whole module imported where one component was wanted, such as import * as Icons followed by <Icons />.
-
got: <Card />? React adds: Did you accidentally export a JSX literal instead of a component? Export the function, export default Card, not the element <Card />.
-
A component from a library? Check the library's docs for its exact import. Names can move between versions.