Search

The Two Reacts

A nice bit of writing from Dan Abramov in which he argues for code that should run on the client, and then again for code that should run on the server. It feels like an elaborate setup to explain React Server Components1 in a part two.

Is there some way we could split components between your computer and mine in a way that preserves what’s great about React? Could we combine and nest components from two different environments? How would that work?

It’s neat that React is getter better SSR support or whatever, and I’m sure it’s very neat with how they share state and such. But mostly I like Dan’s approach here of getting people thinking about where certain types of code is the most appropriate place to run. To be sure: you don’t have to wait for React for that.

I talked to a woman yesterday about the curriculum at the college she oversees, and she said the Advanced Web course they teach has students build the same websites three ways, all client-side, all server-side, and a hybrid. The server-side stuff is PHP, because PHP is a perfectly nice server side language that is perfectly good at generating and returning HTML or data, and still quite popular. But it could be Ruby, Python, Node, Go, or anything else. The language doesn’t matter, is why you are doing it.

  1. Josh has a good explainer on them, and there are other good blog posts around about them. But kinda strangely no official docs other than the announcement blog post from years ago. ↩︎

Wanna take your React skills to the next level?

Frontend Masters logo

React is the web's most popular framework, always topping the charts for JavaScript developers awareness, interest, and satisfaction. We have a huge course on next-level React learning covering hooks in depth, CSS-in-JS with Tailwind, code splitting, SSR, TypeScript, and more. So popular it's now been updated to a third edition!

Leave a Reply

Your email address will not be published. Required fields are marked *

Frontend Masters ❤️ Open Source

Did you know? Frontend Masters Donates to open source projects. $313,806 contributed to date.