NextJS14에서는 아래와 같은 예약된 파일 이름들이 있다.
Reserved Filenames
As you already learned, there are some reserved filenames when working with NextJS.
Important: These filenames are only reserved when creating them inside of the app/ folder (or any subfolder). Outside of the app/ folder, these filenames are not treated in any special way.
Here's a list of reserved filenames in NextJS - you'll, of course, learn about the important ones throughout this section:
- page.js => Create a new page (e.g., app/about/page.js creates a <your-domain>/about page)
- layout.js => Create a new layout that wraps sibling and nested pages
- not-found.js => Fallback page for "Not Found" errors (thrown by sibling or nested pages or layouts)
- error.js => Fallback page for other errors (thrown by sibling pages or nested pages or layouts)
- loading.js => Fallback page which is shown whilst sibling or nested pages (or layouts) are fetching data
- route.js => Allows you to create an API route (i.e., a page which does NOT return JSX code but instead data, e.g., in the JSON format)
You also find a list with all supported filenames & detailed explanations in the official docs: https://nextjs.org/docs/app/api-reference/file-conventions
출처
https://www.udemy.com/course/nextjs-react-the-complete-guide/
'NextJS' 카테고리의 다른 글
[NextJS] 이미지 컴포넌트 사용하기 (0) | 2024.03.13 |
---|---|
[NextJS] 페이지 컴포넌트 props (0) | 2024.03.04 |
[NextJS] a 태그가 아닌 Link를 사용하는 이유 (0) | 2024.03.04 |
[NextJS] NextJS와 순수 React의 비교 (1) | 2024.02.04 |
[NextJS] NextJS 14 프로젝트 생성 (0) | 2024.02.02 |