Folder 따라 layout 이 compose
각 segment 가 자기 layout.tsx 를 선언할 수 있고, 자동으로 nest 돼: child layout 이 parent layout 안에서 render. Render tree 가 folder tree 그대로야.
app/layout.tsx → 모든 것 wrap
app/dashboard/layout.tsx → /dashboard/* wrap
app/dashboard/settings/page.tsx → 두 layout 안에서 render
뭐가 살아남고 뭐가 re-render 하는지
/dashboard/settings 에서 /dashboard/billing 으로 navigate 하면 page 만 swap, 두 layout 다 살아 있음. /dashboard/settings 에서 /marketing/pricing 으로 가면 dashboard layout unmount 되고 marketing 을 wrap 하는 layout mount.
layout.tsx vs template.tsx
Default 로 layout.tsx 써. Navigation 마다 fresh state 또는 enter/exit 애니메이션 필요할 때만 template.tsx — re-mount 함. Folder 안 이름만 다르고 props 는 동일.