Skip to main content

Opting specific segments into a layout

특정 세그먼트만 그룹으로 묶어 공통 layout을 적용하는 패턴입니다.

파일 구조

opting-specific-segments-into-a-layout/
├── page.tsx
├── (with-layout)/account/
│   ├── layout.tsx
│   ├── page.tsx
│   └── settings/page.tsx
└── blog/page.tsx

핵심 파일 코드

// (with-layout)/account/layout.tsx
export default function Layout({ children }) {
  return <section>{children}</section>
}
// blog/page.tsx는 이 layout 영향 없음