DEV Community

Discussion on: How is Remix different from Next.js

Collapse
 
ryansolid profile image
Ryan Carniato

I've been so out of the loop. I assumed everyone had routing solutions like this already. This nested routing technique originated in Ember Router back in 2012 to the best of my knowledge. Since then Vue and Nuxt Router are based on this but I guess it makes sense it hasn't really come into the React ecosystem (except way back in React Router 1.0 I think). With a VDOM you can sort hand waive about the rerendering the top level of the page where you don't have that with reactive libraries that have to repay the creation cost.

I also didn't realize that other libraries weren't server rendering these nested routes. The real question though that I pose as someone who has been using these techniques in my libraries for years. Has remix solved the cascading data issue usually associated with these patterns. I guess from a server only perspective it's trivial, but on the client it means breaking apart the data and the component view code so that the view code can be code split but the data loading happens on the main chunk. Then it's just a matter of good render-as-you-fetch patterns.

I'm not here to solicit though, I'm just generally interested in learning about ReMix and it feels like a lot of things I would have assumed already existing in the React ecosystem are showing up here for the first time and that's exciting.

Collapse
 
ryanflorence profile image
Ryan Florence

Great question about data and nested routes. We've done some smart optimizations around that (well, I think they're smart anyway!).

If the layout persists between route transitions, then the resources for those layouts are not refetched, only the changed routes resources are fetched.

Also, the data, code split route module, and styles are fetched in parallel. We don't need the module to know the data, because our server already knows the hierarchy.