[HN Gopher] Next.js Layouts RFC: Nested routes and layouts, desi...
___________________________________________________________________
Next.js Layouts RFC: Nested routes and layouts, designed for Server
Components
Author : todsacerdoti
Score : 68 points
Date : 2022-05-23 21:37 UTC (1 hours ago)
(HTM) web link (nextjs.org)
(TXT) w3m dump (nextjs.org)
| ElijahLynn wrote:
| Next.js Layouts RFC Discussion is Here >
| https://github.com/vercel/next.js/discussions/37136
| ushakov wrote:
| looks similar to what Nuxt 3 has
|
| https://v3.nuxtjs.org
| freedomben wrote:
| I'm excited to see the wheels turning, but it feels a bit like
| the best feature of Next.js IMHO (SSG) is going to get more
| difficult, or possibly become unusable. A deprecation feels
| incoming. It could be confirmation bias as I've been a little
| worried about that for awhile since people using SSG aren't as
| likely to buy cloud services, so there's some incentive
| misalignment there, but ever since the Image component was only
| supported with SSR it's felt like SSG was going to either become
| less usable or disappear. Am I the only person who loves that
| feature? It really revolutionized how I approach web dev and
| enlarged my imagination of what was possible, so there's
| definitely some emotional attachment for me :-)
|
| Am I correct about SSG's future?
| dimgl wrote:
| Naw, I don't agree. SSG is a killer feature. The fact that
| Next.js is able to do both SSG and SSR means that it's
| positioned to be a wholesale replacement for most React tech
| stacks. You can still have a "CSR-like" app with SSG, while
| having all of the Next.js conventions (such routing, layouts,
| etc.). Additionally, it's actually pretty useful for sites that
| need to be heavily SEO-optimized. Next.js is an impressive
| framework.
| gedy wrote:
| Looks like a nice improvement, looking forward to trying this
| out.
|
| Nested layouts was the one stumbling block we had with next and
| felt very odd that we had to invent our own TabPane component to
| handle this pretty common use case.
| rglover wrote:
| Don't take drugs.
|
| https://github.com/cheatcode/joystick
| austinkhale wrote:
| We're irrationally excited about this internally and we're super
| happy with how the Vercel team has continued to push Next.js
| forward. Thank you!
|
| We're using a version of the persistent layout pattern Adam
| Wathan [blogged
| about](https://adamwathan.me/2019/10/17/persistent-layout-
| patterns-...) but having first-class support for this paradigm
| will be awesome.
| nullcipher wrote:
| "irrationally excited" - what does this phrase mean? that there
| is no basis for your excitement? sounds so cheesy
| leerob wrote:
| Thank you! We've added documentation[1] on the current layouts
| solutions, which is similar to Adam's post. It's a good
| workaround, but I'm very excited for improving the developer
| experience here.
|
| [1]: https://nextjs.org/docs/basic-features/layouts
| michaelsbradley wrote:
| Will there ever be a fix or blessed workaround re: #32216?
|
| https://github.com/vercel/next.js/discussions/32216
|
| previously: https://github.com/vercel/next.js/issues/2581
| reilly3000 wrote:
| Could a smart person please compare and contrast this RFC and the
| ideas of remix.run?
| pier25 wrote:
| According to Ryan Florence (Remix's creator) they are "ripping
| features straight from Remix".
|
| https://twitter.com/ryanflorence/status/1528859776930545665
| madjam002 wrote:
| So we need to give credit now to every little bit of
| inspiration we get when coming up with new features and
| ideas?
|
| Not really sure what the problem is here.
| dimgl wrote:
| It's almost an exact copy aside from the conventions and names.
| It very much _is_ Remix. This is pretty wild. It also brings
| one of my gripes from Remix: parallel fetching. In practice it
| makes sense, but at times there needs to be a way to fetch data
| on a parent route first so that child routes don't fetch again.
| I'm sure Vercel will find a way to solve this.
| leerob wrote:
| Lee from Vercel, happy to answer questions about the RFC or
| future plans for Next.js. This RFC has been years in the making -
| and I'm pretty happy with where we've landed.
| codefined wrote:
| Not seeing it in the article, but how are you handling `index`
| routing in the `app` folder? If you are putting it in the top
| directory (e.g. `/app/index.js`), is it not able to get a
| custom `layout.js` file (as that position is used for the
| global variant)?
|
| If it's in an `index` folder (e.g. `/app/index/page.js`), how
| would one create a route for `example.com/index`?
| saeedjabbar wrote:
| Excited to try this out in my next project :)
| leerob wrote:
| Open to any feedback you have - we've already started work on
| the implementation, and will adjust as necessary based on the
| RFC discussion.
| realce wrote:
| Am I correct thinking this will help create a simpler
| integration with - just hypothetically - Prisma calls that are
| dependent on app auth states in a single page? Replacing auth
| providers and moving them into Layouts?
|
| Daily user, very excited!
| rs_rs_rs_rs_rs wrote:
| >happy to answer questions about the RFC
|
| Would love to hear about the parts of the RFC where you guys
| took some inspiration from Remix!
| leerob wrote:
| https://twitter.com/sebmarkbage/status/1528858510754459648
___________________________________________________________________
(page generated 2022-05-23 23:00 UTC)