4 ms·
For comparison this[1] is Next.js implementation that uses React Server Components (RSC). I feel folks at Remix missed on React Server Components and now it wil
by msoad 5y ago
For comparison this[1] is Next.js implementation that uses React Server Components (RSC). I feel folks at Remix missed on React Server Components and now it will be a lot of work to make it work in Remix. Hopefully I'm wrong.
If you don't know, RSC allows the HTML from server to start streaming as React is rendering the components in the backend. It allows fine grain control to what part of page renders first and which parts can be rendered later as HTML and data is streaming from the server. Before this, all of React server frameworks would render the entire page, shove "hydration data" in it which is mostly repeated data that is used to render the page and also include that HTML in the form of complied JSX in the page in the page scripts. Obviously that would make React SSR very bulky and unscalable. That's why RSC can solve so many React performance problems
[1] https://github.com/vercel/next-react-server-components https://github.com/vercel/next-react-server-components
- kentcdodds 5y agoHere's an objective comparison that Ryan Florence (Remix co-creator) made showing a Remix Hacker News Clone (not the one posted, but one he built himself) vs the Next.js implementation you're talking about here: https://remix.run/blog/react-server-components https://remix.run/blog/react-server-components If React Server Components can improve things for Remix (they can't right now, but maybe they will get better?) and if it is ever released (it's been 5 years now... and they still are saying they've got a long way to go), then Remix will ship support for them and it will be a non-breaking change for Remix users.
- sergiodxa 5y agoI was coming to say something like this, also if Remix ever supports RSC it will most likely (IMO) be under noticed, like you just name a route `.server.tsx` and it will be a RSC and that's it, I don't think Remix will need a breaking change for this and RSC seems more like an implementation detail Remix has rather than something super big for the framework.
- PleaseDisclose 5y agoHey Kent, could you please disclose that you work for Remix as well?
- andrewingram 5y agoWhat's been 5 years? Server components were first shown off just over a year ago. If you mean suspense as a whole, then sure, it's been in the kitchen a long time.
- nvegater 5y agoIm not sure this is a fair comparison. The Nextjs implementation seems more like "let just get it running somehow". OP's codebase is looking scalable and maintainable. Any React developer would have a very easy time getting used to the code (first-glance-readable patterns and functions, uses Typescript etc...) whereas the Nextjs implementation uses very rare patterns and file structure for a Nextjs application (IMHO). For example, where are the styles for the skeleton ? Why inserting CSS with "dangerouslySetInnerHTML" in the index.js ? Maybe its easy and I am missing some obvious stuff but the code doesnt seem very readable to me. Maybe is due to the nature of Server Components in Nextjs ? Would be nice to hear someone else's opinion on the patterns used in this repo. OPs code on the other hand is a piece of cake to understand. Really good job!
- ryanflorence 5y agoRemix co-author here. We haven't "missed on RSC", they aren't even released! We already have experimental versions of Remix running on React 18 and have experimented with RSC, Suspense, and streaming extensively. In their current state however, we're not seeing them beat Remix's current approach in production results or developer ergonomics. We've been providing the React team with our feedback. When these features from React are ready, Remix will be able to easily support them.