Pages and Routing
Blitz.js pages work the same as Next.js pages. If you need, read the Next.js Page documentation
- Unlike Next.js, you can have many
pages/
folders nested insideapp/
. This way pages can be organized neatly, especially for larger projects. Like this:app/pages/about.tsx
app/projects/pages/projects/index.tsx
app/tasks/pages/projects/[projectId]/tasks/[id].tsx
- All React components inside a
pages/
folder are accessible at a URL corresponding to it's path insidepages/
. Sopages/about.tsx
will be atlocalhost:3000/about
.
The Next.js router APIs are all exported from the blitz
package: useRouter()
, withRouter()
, and Router
. If you need, read the Next.js Router documentation.