DEV Community

loading...

TIL: React Server Components

baransu profile image Tomasz Cichocinski ・2 min read

After being late to the party I've finally watched the React Server Components introduction from the React team. Here are my thoughts.

In recent months I felt a need to explore more "traditional" ways of doing web apps. More server rendering, less client-side logic. In my case mostly the Phoenix framework and Phoenix LiveView (it's great). It's really good to see more and more movement in that direction in the React community (with recent additions to Next.js) and from the React Core team itself.

I think current React development is really complex and requires a lot of work with separate backend and frontend "services" and REST/GraphQL API to connect both. If you're using a framework like Next.js and/or your team is full-stack it's much easier because you probably share the same codebase and technology you work in. But that doesn't reflect your application. Still, only the first render of the page happens on the server. With React Server Components you'll get more tools at your disposal to create a better experience for your users.

Knowing that I'm also kind of worried about the complexity of those things. "With great power comes great responsibility" right? For example, React Hooks were a great addition to React and made hard things easy, but also made easy things hard. With React Server Components we won't be talking only about React components and their state or effects but also about their runtime. If this is a shared/server/client component? Will there be a different behavior on server and client? And I'm 100% sure devs will do weird things with direct Node access inside server components. For sure TypeScript and the ungodly amount of Eslint config will make it work great but that's a good thing to keep in mind.

Discussion (0)

pic
Editor guide