News for hackers. Stuff that matters.
Re:Next.js Layouts RFC: Nested routes and layouts, designed ... by gherkinnn on Tuesday May 24, 2022 @04:50AM (#31489609)
I've worked with both. There are days when I prefer a programmatic approach, and days I love the file-based router. With the introduction of routing middleware [0], Next.js finally offers anything I'd want to build.

An option would be to add a catch-all route [1] at the root and implement your own code-based routing. You can still define the desired paths using getStaticPaths [2] but my guess is that some functionality like route-based code splitting will stop working.

0 - https://nextjs.org/docs/advanced-features/middleware

1 - https://nextjs.org/docs/routing/dynamic-routes#catch-all-rou...

2 - https://nextjs.org/docs/basic-features/data-fetching/get-sta...

There are no comments on this comment yet.