๋ฐ์ํ
Intro
next js ๋ฅผ ์ฌ์ฉํ๋ ๋์ค ์๋์ ๊ฐ์ ์๋ฌ๊ฐ ๋ฐ์ํ์์ต๋๋ค.
Error: The default export is not a React Component in page: "/"
Why?
์๋ฌ๊ฐ ๋ ์ฝ๋๋ฅผ ํ์ธํด๋ณด๋, export ๋ง ํ๊ณ default ๋ฅผ ์ ์ด์ฃผ์ง ์์์ต๋๋ค. Next.js์์๋ default๋ก export๋ฅผ ํด์ผ ์๋ฌ ์์ด ์ ์ ์๋ ๋๊ธฐ ๋๋ฌธ์ ๋๋ค.
export function HomePAge() {
const featuredEvents = getFeaturedEvents();
return (
<div>
<EventList items={featuredEvents} />
</div>
);
}
How to solve the problem
export default ์ฝ๋๋ฅผ ์ถ๊ฐํด์ฃผ๋ฉด ๋ฉ๋๋ค. ๐
export default function HomePAge() {
const featuredEvents = getFeaturedEvents();
return (
<div>
<EventList items={featuredEvents} />
</div>
);
}
๋ฐ์ํ
'Framework > Next.js' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Next.js & React] ํ์ผ ๊ธฐ๋ฐ ๋ผ์ฐํ ์์ ํ๊ธฐ (0) | 2022.11.13 |
---|---|
[Next.js] Error: Invalid Link with a child. Please remove a or use Link legacyBehavior ์ค๋ฅ (0) | 2022.11.08 |
[Next.js & React] ํ์ด์ง & ํ์ผ ๊ธฐ๋ฐ ๋ผ์ฐํ (0) | 2022.11.04 |
[Next.js & React] ์์ํ๊ธฐ (0) | 2022.11.02 |
[Next.js] url ๋ก ํน์ page์ ์ง์ ์ ๊ทผ ๋ง๋ ๋ฐฉ๋ฒ (0) | 2022.10.03 |