전체 방문자
오늘
어제
  • 전체 글
    • HTML
    • CSS
    • Javascript
    • React
    • Typescript
    • Next.js
    • Webpack
    • Vue.js
    • Git & GitHub
    • Error
    • Study
    • 개발 일지✨

블로그 메뉴

  • 💡
  • ⚙️
hELLO · Designed By 정상우.
하루

Home

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named i..
Error

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named i..

2022. 11. 1. 11:13

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. 에러 해결 방법

 

원인

해당 컴포넌트의 import 를 다시 하거나 연결되어 있는 컴포넌트들 중에 대소문자가 달라서 발생했을 수 있다.

components의 이름이 잘못되었거나, import path가 잘못 입력되었을 때 발생할 수 있다.

페이지에 들어가는 컴포넌트 함수를 만들지 않고, 메인페이지에서 렌더시킬 시 발생할 수 있다.

 

해결

임포트된 파일의 경로와 이름을 하나하나 확인하기, 함수가 만들어지지 않은 빈 페이지를 연결하진 않았는지 확인하기

export 한 컴포넌트를 참조하고 있는 다른 컴포넌트들의 불러오기 경로 다시 확인하기

 


출처/참고

  • 리액트 에러 상황
  • expected a string or class/function 리액트 에러

 

    'Error' 카테고리의 다른 글
    • [TS] TypeScript가 SVG 파일을 import 하지 못해서 에러가 발생할 때
    • Delete `␍` prettier/prettier 해결 방법
    • windows 10 에서 docker 설치 후 open //./pipe/docker_engine: The system cannot find the file specified
    • [React-native] While trying to resolve module 'idb' from file….this package itself specifies a `main` module field that could not be resolved 파이어베이스 연동 오류 해결 방법

    티스토리툴바