App Router
Recommended instead of pages approach in v13
In /app
:
Folders are used to define routes
[]
page.js
file in that folder makes route segments accessibleCan colocate components, stylesheets, and images
layouts in
layout.ts
show UI that is shared across multiple routes. If multiple layouts apply, they do nested wrappingapp/blog/[slug]/page.tsx
for dynamic slugapp/blog/[...slug]/page.tsx
for catch all slug ie/blog/a/b
and slug is list
A route group(folder that doesn't affect path) can be created by wrapping a folder's name in parenthesis:
(folderName)
app/page.tsx
app/blog/[slug]/page.tsx
Linking
Link component recommended and provides prefetching
Programmatically
Server components programmatically
Last updated