특수 file 셋, behavior 셋
| File | 역할 | Server or Client? |
|---|---|---|
loading.tsx | Page 를 Suspense 로 wrap; data load 동안 보여줌 | 둘 다 |
error.tsx | Segment + 그 아래 error boundary | Client 필수 |
not-found.tsx | Segment 안 notFound() 부르면 UI | 둘 다 |
Root 위한 global-error.tsx
error.tsx 는 자기 layout 의 에러 못 잡음. Root layout 한정 특수 boundary: app/global-error.tsx. 자기 과 render 해야 함 — 깨진 root layout 을 통째로 대체하니까.
아무 데서나 404 trigger
next/navigation 의 notFound() 를 Server Component 안에서 부르면 가장 가까운 not-found.tsx render 하며 bail out. Status code (404) 는 framework 가 알아서.