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](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) and makes use ofasync
/await
in Server Components.
- React extends
fetch
to provide automatic request deduping.- Next.js extends the
fetch
options object to allow each request to set its own caching and revalidating rules.
Data Fetching: Fundamentals | Next.js
React がネイティブの fetch を patch しようとしてる話