라우트 그룹과 중첩 레이아웃
라우트 그룹, 중첩 레이아웃, 공용 및 섹션별 UI를 위한 템플릿 파일을 사용해 복잡한 App Router 프로젝트를 구성합니다.
라우트 그룹과 중첩 레이아웃은(는) CoddyKit의 무료 Next.js 15 Fullstack (App Router + Server Actions) 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Next.js 15 Fullstack (App Router + Server Actions) 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Next.js 15 Fullstack (App Router + Server Actions) 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Why Organization Matters
As an app grows, the App Router lets you structure folders for shared UI without affecting the URL. Route groups and nested layouts are the main tools.
Nested Layouts Recap
Each folder can have a layout.tsx. Layouts nest: a section layout wraps its pages while the root layout wraps everything.
export default function DashboardLayout({ children }) {
return (<section><nav>Dashboard nav</nav>{children}</section>);
}Route Groups
Wrapping a folder name in parentheses, like (marketing), creates a route group. It organizes files but is omitted from the URL.
Multiple Root Layouts
Route groups let you have different top-level layouts — for example, one for marketing pages and another for the app — by giving each group its own layout.
app/
(marketing)/layout.tsx
(marketing)/page.tsx
(app)/layout.tsx
(app)/dashboard/page.tsxURLs Stay Clean
Because (marketing) does not appear in the path, app/(marketing)/page.tsx still serves the URL /, not /marketing.
Template vs Layout
A template.tsx is like a layout but creates a new instance on every navigation, resetting state — useful for enter animations or per-route effects.
export default function Template({ children }) {
return <div className="fade-in">{children}</div>;
}When to Use Template
Use a template when you need state or effects to re-run on each navigation; use a layout when you want shared UI and state to persist across navigations.
Organizing Without Routing
You can also use route groups purely to colocate related routes under one folder without adding a URL segment, keeping the codebase tidy.
Shared UI in Layouts
Put navigation, sidebars, and providers in the nearest layout so they persist and avoid re-rendering on navigation within that section.
Loading and Error per Section
Each segment, including grouped ones, can have its own loading.tsx and error.tsx, scoping fallback UI precisely.
Putting It Together
A typical app: a (marketing) group with a public layout, an (app) group with an authenticated layout, each nesting further section layouts.
Quick Check
What does wrapping a folder name in parentheses do?
Recap
You learned to structure apps with nested layouts for persistent shared UI, route groups (name) that organize without changing URLs and allow multiple root layouts, and templates that remount on navigation.
AI 튜터와 함께 TypeScript을(를) 배우세요 — 무료
브라우저에서 실제 코드를 작성하고 실행하며, 24/7 AI 튜터로부터 즉각적인 도움을 받고, 웹이나 앱에서 중단한 부분부터 계속 학습하세요.
- 코스
- 22
- 레슨
- 88
자주 묻는 질문
“라우트 그룹과 중첩 레이아웃” 강의는 무료인가요?
네 — “라우트 그룹과 중첩 레이아웃” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Next.js 15 Fullstack (App Router + Server Actions) 강의 전체를 잠금 해제할 수 있습니다. Next.js 15 Fullstack (App Router + Server Actions) 강의에는 총 4개의 강의가 포함되어 있습니다.
“라우트 그룹과 중첩 레이아웃”에서 뭘 배우나요?
라우트 그룹, 중첩 레이아웃, 공용 및 섹션별 UI를 위한 템플릿 파일을 사용해 복잡한 App Router 프로젝트를 구성합니다. 브라우저에서 직접 실행하는 실습 코드로 Next.js 15 Fullstack (App Router + Server Actions)을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Next.js 15 Fullstack (App Router + Server Actions)을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Next.js 15 Fullstack (App Router + Server Actions)은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.
“라우트 그룹과 중첩 레이아웃” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Next.js 15 Fullstack (App Router + Server Actions) 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Next.js 15 Fullstack (App Router + Server Actions) 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 레이아웃 및 페이지 컴포넌트
- 동적 경로 및 매개변수
- 로딩 및 오류 UI
- 라우트 그룹과 중첩 레이아웃