본문 바로가기

React

Error: 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 a..

반응형

 

내가 만난 에러

 

 

Error: 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.

 

 

 

Attempted import error: 'AppLoading' is not exported from 'expo'.

 

 

 

 

이때 사용했던 코드는 

import { AppLoading } from 'expo';

 

강의듣는데 강의가 2019년이라 그런지 버전이 변경되었나보다 

 

 

 

 

이를 

import AppLoading from 'expo-app-loading';

 

이렇게 변경해주니 완료.

 

 

 

 

혹, expo-app-loading 설치를 안했다면

expo install expo-app-loading

 

 

근데 구글링 해보니 대체적으로  Element type is invalid: expected a string (for built-in components) or a class/function... 에러는 import 시 {} 거나 글자 대소문자 문제인것으로 확인됨.

 

반응형