React Server Components are a bad choice (for shipping)
Making the case that you should not use React Server Components if you want to ship applications quickly. If you want to learn, experiment, or make content, by all means!
Everything I said
I have been seeing a lot about React server components. It's all over Twitter, it's all over YouTube. And so I decided to dig in a little bit and take a look at it, and I saw a lot of screenshots and a lot of code samples like this, and I thought, "Man, this looks familiar. This looks a lot like PHP." But it looks like PHP from, like, ten or 15 years ago.
I don't know any modern PHP developer that would write something like this. And so I've been trying to figure out what all the excitement is about, and I have a little bit of a hot take on React on the back end. I feel like I should have some lighting effects that show when the hot take starts. Time for a hot take. I do not think you should use React on the back end.
That's my hot take. I don't think you should use React on the back end. I think the new React server components are extremely interesting. The technical implementation is very, very cool, and I like the concept of React server components. However, I don't think they're going to be productive. So I don't think you should use them on the back end if, if your goal is to ship a product to users, I don't think you should use React server components.
If your goal is to learn something interesting or to play around with something or to create content, absolutely use React on the back end, explore, have fun. But if your users need to log in, they need to write to the database, they need to reset their passwords, you need to have caching, I don't think you should use React on the back end. I'm going to try to convince you why, but I wanna show you that other people are seeing this as well.
I'm seeing stuff like this all the time, where people are saying, "Hang on, I picked up one of these back-end frameworks that are old and crusty, and it has everything that I need." So maybe these back-end frameworks that are tried and tested and fully featured, maybe they're not as old and crusty as the influencers might have us believe, right?
Maybe there's a reason they still exist. But we gotta talk about how we ended up here today, which leads us to the hype cycle. The hype cycle is very real, and if you're not careful, you're gonna get swept up in it. We can go all the way back to, to single-page applications. When we first took the entire application and put it on the client side and reinvented a bunch of stuff in the browser that already existed.
That was the first hype, and then we realized, wait, we need to render some of this on the server so that search engines can read it. Maybe the first-run experience is a little faster, and then we'll hydrate on the client side. So then we invented server-side rendering of client-side apps. Okay. Then we moved on and said, "Wait, even servers are bad. We all have to do serverless." And then we moved on and said, "Even serverless is bad.
We all need to be at the edge." What is the edge? Is it a runtime? Maybe. I don't know. Is it a place? Maybe. I don't know. But if you're not on the edge, you're doing it wrong. And now the hype has come all the way back around to server-side actions. We're doing stuff on the server again. Whew. That was a lot.
That was a whole lot. The hype is swinging back to the server side, and I, for one, am thrilled about it. I'm a full stack web developer, but I love server-side development. Client-side is okay. I love server-side development. And here's what I want to encourage you to do as the hype train continues. Take a second. Take a second and look around the back-end web ecosystem and realize what's already there.
There are incredible back-end frameworks that you can pair with React. You don't have to give up React, but you can pair it with a fully featured back-end web framework. If you go down the route of using React on the back end, you will be solving problems that were solved ten and 15 years ago. And specifically, I'm talking about Ruby on Rails, Laravel, and Django.
They have solved problems. They've been around for so long that almost, almost every back-end problem has been solved by these frameworks. User authentication? Built in. Queues? Built in. Cron jobs? Built in. ORM? Built in. Sending email?
Built in. That's what I'm talking about. These web frameworks that have been around forever have solved every problem that you as a web application developer might have. You just have to answer one simple question, and it's: what do you wanna do with your life? I mean, it's kind of a hard question, right? So if you wanna build a, a SaaS product and ship it to users, I would encourage you to use the front-end framework of your choice and use Laravel, Rails, or Django on the back end.
They've solved all of the problems that you're going to come across. If you want to help usher in the JavaScript revolution of React on the back end, you should do that. That is a totally fine way to spend your life. But before the hype cycle sweeps you away, you need to stop and think, "What am I optimizing for? Am I optimizing for shipping things to users?
I should pick a back-end framework that is feature complete. Am I optimizing for ushering in a, a JavaScript revolution?" Well, that's fine. Do that. And before you say, there are packages for all of this. There are packages for user authentication, there are packages for cache and ORM and sending emails. I would agree. I would fully agree. I think the test is this: can you go to a single website that, that represents your back-end framework and view the documentation for all of those
things under the same roof? Or are you going to your user authentication documentation and your caching documentation and your sending email documentation? Are they all in separate places? 'Cause every time you add a package in and you're cobbling together this Frankenstein framework, it adds a maintenance burden.
Of course, these packages are upgraded independently. They don't know anything about each other. But it adds a coordination burden more than that. You have to figure out, okay, well, how does my, how do my, y- how does my user auth package integrate with my background job package? And how does my sending email package integrate with my cron job package?
And it's like you're on your own for putting that together, and every time you add a new one in, the lines between those explode geometrically. So that would be my encouragement to you is look for a back-end framework that has all of that under one roof. You love React. You love React because the, the ecosystem is strong, the community is great.
That's fine. Keep React on your front end. It is a strong ecosystem. What I'm telling you is there's a parallel ecosystem on the back end. There are ecosystems where the documentation is incredible. The problems have all been solved. The community is wonderful and welcoming. And so I would encourage you to look at those ecosystems that already exist.
If you want to be the one that brings that to React on the back end, that's great. If you want to ship an application quickly, perhaps consider not using React on the back end. Thank you for watching. I read every single one of the comments, even ones like this. So if you have any thoughts or anything that I just totally messed up, please leave a comment.
Until the next time, see ya