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?

Leave a Reply

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

Did you know?

Frontend Masters Donates to open source projects. $363,806 contributed to date.