Routing: Fundamentals | Next.js
pagesディレクトリは一応まだ使える
pagesとappでパス名が被るとビルド時にエラーが出るらしい
appの中身はデフォルトでReact Server Componentsとして扱われる
special filesで気になるもの:
route.js そのパスに対するGET, POST, PUT, PATCH, DELETE, HEAD, OPTIONSを定義(上書き?)できる
Routing: Route Handlers | Next.js
template.js
Routing: Pages and Layouts | Next.js
<Layout>
{/* Note that the template is given a unique key. */}
<Template key={routeParam}>{children}</Template>
</Layout>
ドキュメント読んだメモ
The new data fetching system is built on top of the native
fetch()Web API and makes use ofasync/awaitin Server Components.
- React extends
fetchto provide automatic request deduping.- Next.js extends the
fetchoptions object to allow each request to set its own caching and revalidating rules.
Data Fetching: Fundamentals | Next.js
React がネイティブの fetch を patch しようとしてる話