에러 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.
해결방법 :
import 부분을 확인한다.
{ } 괄호로 import되었는지 확인해 본다.
잘못됬던 부분 :
import {NewsLayout} from '~/components/layout/NewsLayout';
해결한 방법
import NewsLayout from '~/components/layout/NewsLayout';
NewsLayout의 컴포넌트도
export default로 내보내는 것으로 바꿔주었다.
import { PropsWithChildren } from 'react';
import Footer from '../common/Footer';
import { HeaderWhite } from '../common/Header_white';
type NewsLayoutProps = {};
const NewsLayout = ({ children }: PropsWithChildren<NewsLayoutProps>) => {
return (
<div className="bg-primary">
<HeaderWhite />
<main>{children}</main>
<Footer />
</div>
);
};
export default NewsLayout;
'에러,오류 해결' 카테고리의 다른 글
cornerstone 관련오류 SharedArrayBuffer is NOT supported in your browser 해결 (0) | 2024.09.26 |
---|