Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
October 29, 2020 02:28 pm GMT

How is Remix different from Next.js

Yesterday I published A First Look at Remix.run

Since then, I keep getting the question of "How is Remix different from Next.js" (which is a good question since they share "some" of the same ideas).

I've only been using Remix for a day or so, but I've been chatting with Michael and Ryan about it and can speak to what I know so far (and these answer will evolve over time). I also will evolve this answer based on the answers provided in this thread and that I see over time in other forms / discussion areas. (Disclaimer - this is my opinion!)

The differences

I think the main differentiators are here:

1. Nested routes

One large difference is how the routing works. Nested routes and params are supported in Remix, and "are a critical idea to understand in Remix" (according to the docs).

Using an Outlet from React Router Dom, you can build out a hierarchy of nested routes with a pretty simple to use API.

These nested routes are server-rendered, bringing to the table almost a hybrid of SPA and SSR that is completely new.

Routing (and the API behind it in general) also works a lot differently than with Next.js.

2. Complete control over the request from an SSR route

You have a lot of control over the data returned for a route having full control over the responses (including sending cache control headers).

If you set cache headers on your responses, when the user visits the same route, it wont' even fetch the data, it'll use the cache. And if you put a CDN in front of your server, the server will rarely actually handle the requests because the CDN will have it cached.

Here is some info directly from their docs.

Remix docs - 1

Remix docs - 2

Remix docs - 3

3. There is no SSG

Is it better / worse?

I really don't think the question is if it's better or worse.

I think the real answer is that it's different and IMO doesn't really serve the exact same use cases. To me, it's closer to a replacement for doing stuff like what Rails, Django, or Laravel does but using React and with more cache control and flexibility almost like a hybrid between SPA and SSR?

It seems well suited for an app with highly dynamic data, especially for sites with a large number of pages.

More to come, but I look forward to hearing the discussion and evolving my opinion and answer!


Original Link: https://dev.to/dabit3/how-is-remix-different-from-next-js-4jd1

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To