Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 26, 2022 05:24 pm GMT

3 reasons why you should use Remix instead of Next.js

3 things that I came across this week:

1. Developer Experience

I tried migrating the React (Frontend only) to Next.js and I got tired, I built about 50-70% but I did not like all the workarounds I had to do, such as getLayout. I'm about to finish a Frontend AND Backend (previously with NET Core) version with Remix, and I learned about Remix last Saturday I think.

2. React Router / Layouts

Since Remix is built on top of react-router v6, I set up my application using multiple layouts. For example, I have 2 application layouts, AppLayout (/app) and AdminLayout (/admin). When migrating to Next.js, look at all the "AppLayout" occurrences:

AppLayout - Nextjs

Notice the 114 occurrences? And this is just for AppLayout, I have worked with many more layouts. I'm sure there's a better and cleaner way to do this, but I did not find it. That's part of the Developer Experience.

Now with Remix, 9 occurrences in 3 files:

AppLayout - Nextjs

3. State management

Instead of using redux to get the state, I can get it with useMatches. This is what my app loader looks like:

useMatches

So I can access this data anywhere that starts with /app/* or /admin/* with the useMatches() hook, without spinners all over the page.

--

I'm going to give Next.js a try (again). But for now, I'm sticking with Remix.


Original Link: https://dev.to/alexandromtzg/3-reasons-why-you-should-use-remix-instead-of-nextjs-5554

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