Error: Element type is invalid: expected a string (for built-in components) or a class/function❗️

2024. 6. 26. 18:16·Project & Troubleshooting/Troubleshooting

Error: Element type is invalid: expected a string (for built-in components) or a class/function❗️

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

오류발생원인

  • components 의 이름과 코드 경로가 잘못됬을경우 발생
  • export default 작성하지 않을때도 발생

본인은 뒤에 export default 작성하지 않아서 오류가 발생

실수코드 예시

'use client';

import SideBar from '@/components/SideBar/SideBar';
import ThumbnailEditor from '@/components/ThumbnailEditor/ThumbnailEditor';
import styled from 'styled-components';

const Container = styled.div`
  display: flex;
  flex-direction: row;
`;

const thumbnailgenerator = () => {
  return (
    <Container>
      <ThumbnailEditor />
      <SideBar />
    </Container>
  );
};

 

위에 코드에 마지막에 export default thumbnailgenerator 를 작성하지 않아 오류가 발생했다.

반응형

'Project & Troubleshooting > Troubleshooting' 카테고리의 다른 글

[React-Native CLI] react-native-vector-icons 설치에러 해결 과정  (0) 2025.01.13
[ React-Native CLI ] 설치후 Build 안되는 에러해결 방법  (0) 2024.12.25
[ React-Native CLI ] 개발 오류 ❗️Execution failed for task ':react-native-safe-area-context:compileDebugKotlin'.  (2) 2024.12.25
Next.js 에❗️TypeError: Cannot read properties of undefined (reading 'prototype')  (1) 2024.05.13
❗️Parsing error : Cannot find module 'next/babel’ 오류 해결  (3) 2024.05.08
'Project & Troubleshooting/Troubleshooting' 카테고리의 다른 글
  • [ React-Native CLI ] 설치후 Build 안되는 에러해결 방법
  • [ React-Native CLI ] 개발 오류 ❗️Execution failed for task ':react-native-safe-area-context:compileDebugKotlin'.
  • Next.js 에❗️TypeError: Cannot read properties of undefined (reading 'prototype')
  • ❗️Parsing error : Cannot find module 'next/babel’ 오류 해결
WHITE_FROST
WHITE_FROST
개발공부리뷰블로그
  • WHITE_FROST
    하얀하얀IT
    WHITE_FROST
  • 전체
    오늘
    어제
    • 분류 전체보기 (138)
      • Infra (5)
      • Project & Troubleshooting (14)
        • Troubleshooting (7)
        • Dev Tools (4)
      • Frontend (30)
        • Next.js (9)
        • React (13)
        • TypeScript (2)
        • JavaScript (6)
      • Mobile (17)
        • React Native (16)
        • Android (1)
      • Backend & Data (7)
        • Database (3)
        • Java (1)
        • Python (2)
        • Design Pattern (1)
      • AI (7)
        • Models & API (1)
        • AI Notes (6)
        • AI Tools (0)
        • Local AI (0)
        • Concepts (0)
      • Problem Solving (52)
        • Algorithm Notes (6)
        • Algorithm Practice (46)
      • Growth Log (9)
        • Study Log (6)
        • Tips (0)
        • Etc (3)
  • 블로그 메뉴

    • 홈
    • 태그
    • 미디어로그
    • 위치로그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    코테
    mongodb cloud
    티스토리챌린지
    react
    boj
    reactnative
    SWEA
    프로그래머스
    Ai
    React Hooks
    Claude
    java
    hooks
    javascript
    d1
    리액트네이티브
    react-native
    Python
    error
    ios
    Expo
    알고리즘
    코딩테스트
    React-Native cli
    ReactHook
    react-native-maps
    오블완
    D2
    백준
    Next.js
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.5
WHITE_FROST
Error: Element type is invalid: expected a string (for built-in components) or a class/function❗️
상단으로

티스토리툴바