3 ms·
> In order for this to work, we'd need to be able to give React a chunk of code that it runs exclusively on the server, to do the database query This is not tr
by xixixao 3y ago
> In order for this to work, we'd need to be able to give React a chunk of code that it runs exclusively on the server, to do the database query
This is not true/it’s misleading. What you need is to be able to fetch on the server, and hydrate on the client using data from the server. This is possible with SSR and injecting into the React stream, using isomorphic (client) components.
The article is great, but the reasons for RSC are more subtle/complicated than the flow of the article would imply.
- xixixao 3y agoYou can see a live demo of this here (using Remix and https://github.com/brillout/react-streaming https://github.com/brillout/react-streaming): https://blessed-ibis-783.convex.site/ https://blessed-ibis-783.convex.site/ The relevant isomorphic data fetching hook source code is here: https://github.com/xixixao/convex-hosting/blob/main/app/hooks.ts https://github.com/xixixao/convex-hosting/blob/main/app/hook...