
root์ layout.ts ๋ง์ง๋ฉด์ ๊ฒฝ๋ก๋ฅผ ์์ ํ๊ณ ์์๋๋ฐ, ํฉ๋นํ๊ฒ ์ด๋ฐ ๋ ์ด์์์ด ๋์๋ค.
์๋ฌํ์ด์ง๋ฅผ ๋จธ๋ฆฌ์์ ์๊ณ ์๋ค๊ฐ ์ด๋ ๊ฒ ๋จ๋๊น ์๊ฐ๋จ..
layout.js๊ฐ ๋ฃจํธ์๋ง ์๊ณ ๋ถ๊ธฐ๋ณ ์ฒ๋ฆฌ๊ฐ ๋์ด์์ง ์์์ ์ ์ญ์ ์ผ๋ก ์ ์ฉ๋๊ธฐ ๋๋ฌธ์ ์๊ธด ๋ฌธ์ ์๋ค.
๊ทธ๋ฆฌ๊ณ ์ด ๋ ์ด์์ ํ์ผ์ด app/(foldername)/page.tsx์ฒ๋ผ ()๋ก ๋ผ์ฐํฐ ํ์ด์ง๊ฐ ์จ๊ฒจ์ ธ ์์ด๋ ํ์ ํด๋ ์์ ํ์ด์ง์ ์ ์ฉ๋๊ธฐ ๋๋ฌธ์ ๋ฐ์ํ๋ค.
https://nextjs.org/docs/app/building-your-application/routing/route-groups
๊ณต์ ๋ฌธ์์์ ์ด ๋ถ๋ถ์ ๋ณด๊ณ ๋ค์๊ณผ ๊ฐ์ ๋ฐฉ์์ผ๋ก ํด๊ฒฐํ๋ค.
๋จผ์ ๊ธฐ์กด์ root layout ํ์์ ๊ทธ๋๋ก ์ฌ์ฉํ ํ์ด์ง์ ์๋ ํ์ด์ง๋ฅผ ๋๋๊ณ ,
- app/(with-layout)/foldername/page.tsx
- app/(with-layout)/layout.ts
๊ธฐ์กด์ root layout ํ์์ ๊ทธ๋๋ก ์ฌ์ฉํ ํ์ด์ง๋ค์ ์์์ ๋ณด์ด๋ (with-layout) ํด๋ ์์ผ๋ก ๋ฃ์๋ค.
๊ทธ๋ฆฌ๊ณ ๋ค๋ฅธ layout ํ์์ ์ฌ์ฉํ ํ์ด์ง๋
- app/(without-layout)/[...not_found]/page.tsx
- app/(without-layout)/layout.ts
- app/(without-layout)/not-found.tsx
์ฒ๋ผ (without-layout) ํด๋๋ก ๋ฃ๊ณ ๊ตฌ๋ถ์ง์ผ๋ฉด ๋๋ค.
next.js์์ [...]์ ๋์ ๋ผ์ฐํ ์ ์๋ฏธํ๋ค.
- All requests to /api/auth/* (signIn, callback, signOut, etc.) will automatically be handled by NextAuth.js.
์ด๋ ๊ฒ ๋ฌถ์ด์ ๋ฃ์ด์ฃผ๋ฉด () ์์ ํ์ด์ง์๋ () ์์ layout.ts๊ฐ ์ ์ฉ๋๋ค.

Routing: Route Groups | Next.js
Route Groups can be used to partition your Next.js application into different sections.
nextjs.org
'What I Learn' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
OSSCA: LLM ์กฐ์ฌ, Continue ๋ถ์ ๋ฐ ์ ๋ฆฌ (8) | 2024.10.24 |
---|---|
next-auth๋ฅผ ์ฌ์ฉํ ์นด์นด์ค ๋ก๊ทธ์ธ (4) | 2024.10.22 |
OSSCA: customize prompt & set a completionOptions in Continue (2) | 2024.10.02 |
OSSCA : setting the Continue at vscode & Overview (0) | 2024.09.23 |
์ ์ญ์์ ๋ชจ๋ฌ ์ํ๊ด๋ฆฌํ๊ธฐ (redux-toolkit) (1) | 2024.09.20 |