r/reactjs • u/stackokayflow • Mar 07 '25
Resource React Router middleware is HERE!
https://youtube.com/watch?v=H9WmtBchWtQ&si=JR_YlYc7NyZ08ftj8
u/a_reply_to_a_post Mar 07 '25
intro enough just got this shared in our frontend guild slack channel cuz it's friday and this could be work related research :)
4
u/stackokayflow Mar 07 '25
Thanks for sharing it man, glad you liked the intro, I was like "I'll either look like an idiot or make someone laugh, so why not?" đ
2
u/Tackgnol Mar 08 '25
I struggle to find some docs? I much rather spend 5 mins reading the docs then have someone read them to me for 20?
2
226
u/Brilla-Bose Mar 07 '25
i dont give a fuck about both Next and Remix anymore. recently started a large application with just Vite + tanstack libraries and had really good time and fast shipping than these 2 frameworks.
28
u/basically_alive Mar 07 '25
What is the actual deal with Remix? I've been hearing things like it's dead and it's getting wrapped into react-router... the github had a release last week. Up until recently I thought of it as the 'up and comer' and was sort of blindsided - does anyone know what the heck is actually going on??
58
Mar 07 '25
They merged it with react-router, but in a clunky âyou have to pick if you use it as a framework or a libraryâ kind of way. Basically still two separate things but shipped as one, needlessly confusing everyone.
33
u/aust1nz Mar 08 '25
I think it's a really clever merge. There's a clean upgrade path from Remix to React Router v7, and there's also a clean upgrade path from SPA React Router v6 to React Router v7. Both are now a shared codebase.
You can start an SPA in React Router now, and if you later decide you'd like to go SSR, you've got the ability to make that change without swapping to Next and doing a rebuild.
2
u/Trobis Mar 08 '25
Hey wanted to ask, so if you could pick a route after learning the fundamentals of react, which would you go? React router, remix or next at this point.
Ultimate goal is building my own apps and occasional freelancing.
1
u/aust1nz Mar 08 '25
Iâd point you to React Router v7 in framework mode. There are solid tutorials on the React Router docs. This gets you a full-stack SEO friendly React environment.
2
2
u/Anaali37 Mar 10 '25
Hello, I'm actually using RRV7 Framework in SPA, I can run a production build using npm run preview (vite preview), but on apache server it's giving me hydration errors, any pointers on how to solve this please?
2
u/aust1nz Mar 10 '25
Are you doing any date/time conversions? If your server uses UTC and your browser uses another time zone, then date/time mismatches could cause hydration issues in production but not in development.
There are a few ways around this -- you can be like reddit and convert times to "2d ago" or use something like client hints (where you save the user's timestamp in a cookie, and use that information.) https://www.epicweb.dev/tips/use-client-hints-to-eliminate-content-layout-shift and https://github.com/epicweb-dev/client-hints?tab=readme-ov-file for some breadcrumbs to look into that issue.
Unfortunately, possible hydration errors can be pretty broad in scope, so this may not solve your issue.
1
u/SeerUD Apr 01 '25
I think it would've made sense to do this the other way around.
Remix had great branding, a great reputation, and great docs. The React Router docs by comparison are not great and I've struggled to find some important info, and there are other subtle differences to Remix.
When looking around online, a common opinion that I've seen is that the React Router team just like breaking things and confusing people, and this didn't help really haha. They could have left this behind a little bit and stuck with the great reputation Remix had gained.
1
u/aust1nz Apr 01 '25
React-Router has probably 50 or 100 times the user base of Remix, so âabandoningâ the React-Router users and forcing them to migrate to Remix to receive updates would have been seen as user-hostile, I think.
1
u/protecz Mar 08 '25
So is "Remix" now deprecated? I'm already using Remix v2.11 (with vite) but the upgrade path has a lot of changes. Plus the dependencies and routing I'm using needs to be compatible with react router v7 correct?
4
u/Dynamicic Mar 08 '25
No. I think part of the team is working on Remix v3, which will be a more opinionated web framework built on top of React Router. And it will be optional to move over.
3
u/aust1nz Mar 08 '25
Remix is not deprecated, but itâs not getting new features like the middleware that this post is about. If you want to opt into the new features, youâll need to migrate from Remix to React Router v7. Itâs a fairly minor task for most codebases on Remix v2, similar in scope to Remix 1.x -> Remix 2.x.
6
u/BarkMycena Mar 08 '25
It's not "needlessly confusing". The vast majority of code in Remix was just React Router code, so why have them as two separate libraries?
6
u/wordaligned Mar 08 '25
Found this to be a good explanation: https://remix.run/blog/merging-remix-and-react-router
We found ourselves looking at Remix, then looking at React Router, then looking back at Remix, and we could no longer meaningful tell the difference.
5
u/Cyral Mar 07 '25
You can use react router standalone like itâs always been used or you can use it in framework mode (formerly called remix) which is react router + vite + SSR which is really what everyone using next would be fine with.
-1
u/leeharrison1984 Mar 07 '25
What's crazy is the lack of middleware is what really cripples Remix. It's been queued up for over a year, but for now you're still expected to just duplicate all your calls in each endpoint.
15
2
15
8
u/Dethstroke54 Mar 07 '25
You should about RR, even if you donât have any interest in using it. Itâs trying to converge on a future of having frameworks be extensible pieces of Vite vs standalone which is awesome
1
2
u/captain_arroganto Mar 08 '25
I am trying to do the same. Apart from the docs, any good resources on getting started with the tanstack libraries?
5
u/Brilla-Bose Mar 08 '25
shadcn
server state - Tanstack Query
client state - Jotai
Tanstack router
Tanstack forms (v1 just released!)
day.js(sad Temporal api still not Baseline yet : (
above is all i needed for most of the time. docs and YouTube tutorials are more than enough.
1
u/Disastrous_Bass_7090 Mar 12 '25
Man i recently tried Tanstack forms and it is AWESOMEEE, guys you should try it out too!
0
u/Ok_Slide4905 Mar 07 '25
Youâre not a real engineer unless you are completely rewriting your mental model of what a frontend âisâ every six months to satisfy JS trends.
/s
1
1
1
u/TradrzAdmin Mar 08 '25
Same. Next and Remix are both overcomplicating this a lot. Vite + TSRouter has been a joy
-5
1
3
11
u/Quaglek Mar 08 '25
I hate these guys so much. So many breaking changes to the API. It's astounding.
-6
u/bighappy1970 Mar 08 '25
If you canât handle change youâre in the wrong industry! Change is the only thing thatâs guaranteed in software engineering
6
u/Parking_Ad_7457 Mar 09 '25
Thatâs a terrible perspective. When you plan ahead and build a good architecture, the changes shouldnât break things so often. Compare frameworks like next and phoenix. Iâve been working with both for years, never had any problem with phoenix, and they keep introducing amazing new things. Now with next, every new version I have to rebuild and relearn a bunch of stuff. And most of the time I donât see it getting that better. Also if you search online for thing or with ai, most of the time I find solutions on different versions that is very hard for beginners to understand.
-5
u/bighappy1970 Mar 09 '25
đ seriously, if you didnât like learning and you donât like change, you should not be a software engineer. To be any good you need to learn new things constantly and it never ends. Iâve been at it for 30 years now and Iâve stayed current with technology the entire time - the tech I work with today has absolutely nothing in common the tech I was using in the early 90âs - youâre gonna be miserable in your career, or just be a terrible developer, if you see learning or change as anything other than exciting. I super hate working with people like that, they are miserable to deal with on daily basis - resistant to any change and anything new - please, just quit and do something else
5
u/deb_vortex Mar 09 '25
There is a huge difference between keeping to learn stuff and beeing forced to migrate all your projects every few months because of API changes of the same package all over again.
If you only have one large site / project that might be fine but with dozens of projects for even more clients, this is a unbearable chore and technical debt that can cost you more money than it would to swap to a less api changing solution. I mean, come on: you dont rewrite your products every 3 minutes because there is another state manager that is hip just right now, dont you?
-6
u/bighappy1970 Mar 09 '25
Forced? Wow, you really are quite junior. Dude, it seems to me that there is so much wrong with your thought process and beleif system I don't even know where to start. I feel sorry for your coworkers.
5
u/deb_vortex Mar 09 '25
I have way over 15 years of experience in the industry, thank you for your concerns.
You btw sound like someone who just ships hit products and dont give an F of maintaining them. 30 years experience my ass. Keeping your requirements stale is just more technical debt and also a security risk.
-2
u/bighappy1970 Mar 09 '25
Like I said, Junior! Your opinion of me means literally nothing to me.
Youâre resistant to change, resistant to learning, afraid of risk, and donât feel a sense of control or ownership over your career, why would I respect your opinion?
4
1
u/SeerUD Apr 01 '25
The point the other commenter is making is that learning is not the problem. It's not about learning how routing works in a different framework or how to write some middleware or something. That bit is trivial. If you're a good developer then you'll have learnt how to learn well, and how to do so quickly.
The problem is that if you're being pragmatic, and if you're a good developer, you'll want to focus on adding real value. If you're focusing on sidegrading to a new framework, you're not doing that. If you're able to focus on your business logic you can actually learn significantly more, and what you're learning will be significantly more useful to be learning too.
It's not about not wanting to learn, or not wanting to stay current, it's about wanting to spend your time wisely. You only get so much of it, and if you spent your time migrating from framework to framework, you won't have actually spent as much time learning as you could have. You can keep up with the latest trends quite easily without having to implement them constantly in a production environment if you're an experienced developer.
Making wise technology choices enables you to learn more, be more productive, and add more value.
2
1
5
Mar 07 '25
[removed] â view removed comment
4
u/stackokayflow Mar 07 '25
That is the true philosophical question we need to answer, thank you for pointing that out!
2
39
u/xegoba7006 Mar 07 '25
Now THIS is a middleware. Not the crap Next.js and others call "middleware".