But with RSC model, we are adding a new layer. We are adding a new server layer. So, this is the most important moment. We are executing React Components on the server. And then, we are streaming by chunks to the client. And by streaming, we are only streaming parts that will be displayed. So, we are not streaming unnecessary data, unnecessary props, or parts of the components.
Thanks to this, that we are executing on the server, we can access files on the server, we can access database, or we can make some smart move with cache to speed up our request. And it's all thanks to this format that is, as I said, streamed from a server. It looks like a JSON, but it's not. It's React Server Components specific format that is consumed on the client side. It contains things that should be displayed reference to the components, et cetera.
So, how does React Native fit to this whole image? And how even we can implement a server part inside React Native? So, everyone is talking about React Server Components in context of web, because that's where we have production ready implementation. But actually, in fact, server components were initially founded at Meta because of the promise they were showing when using server driven technologies on Native. And that's a nice plot twist. A lot of people think about RSC only in web context, but maybe they make some sense on mobile. But what architecture and what cost would it take to implement it?
So, React is on the repo, and two packages that are most important for us today are React Client and React Server. They contain logic for React Server Components, but only unified logic. So, the same logic will be applied for any bundler and any renderer. The custom logic is implemented through the config files. So, as we can see here, for example, for TurboPack, we have one config file, and for Webpack, we have another. And that's where we can possibly add a config file for React Native renderer and for Metro, which is a default bundler for React Native.
The main argument for React Server Components, as I mentioned, is reducing initial bundle size. So, the first chunk of the application will be shown really, really fast. But in mobile, we don't care that much about bundle size. We are downloading up once from the app store, and then app just exists there. Every time user visits the app, bundle is just there. And thanks to Hermes, the JavaScript engine designed for React Native purposes, the startup time for the application is pretty much the same for the application that has bundled 10 megabytes or 100. There are various apps, but I strongly believe that there's a space for RST on mobile. There are online first app and there are offline first app.
Comments