fable-compiler / fable-react

Fable bindings and helpers for React and React Native
MIT License
273 stars 67 forks source link

React Server Components integration #211

Open delneg opened 3 years ago

delneg commented 3 years ago

Recently, a new RFC was published called React Server Components, which brings a new life to "do it on the server" approach. Related links: https://github.com/reactjs/server-components-demo https://www.youtube.com/watch?v=TQQPAU21ZUw https://github.com/josephsavona/rfcs/blob/server-components/text/0000-server-components.md

I've got some questions to ask Fable team: 1) Is an integration of this approach possible ? 2) How hard is it to do so, if it is ? 3) What can be the benefits of using RSC ? 4) Can it possible be combined with Fable.Remoting and / or use a similar approach to have F# client + server, with zero-cost bundles and type-safe client-server communicationg ? 5) Any other thoughts on the topic, etc.

alfonsogarciacaro commented 3 years ago

TBH I've only read very briefly about React Server Components so I'm not sure. But I'm assuming this is only for node.js servers? If that's the case, I think it will be difficult because, although some devs use Fable to write node servers, most of F# devs use dotnet on the server side (if my intuition is correct). The most popular F# servers already can generate HTML. If the idea of having components that look like client components but are rendered on the server (is that the mechanism?) catches on, we'll probably need to develop our own solution that's compatible both with dotnet and Fable.

delneg commented 3 years ago

First of all, please take time to look into this feature in detail - it's all about sending JSON (or possibly any other structured data format) between server and client during server rending, instead of HTML (as of right now in SSR). The concept is similar as if we were sending Elmish model, processed by a mailbox on the server to mailbox on the client. And yes, i was talking about .NET backends mainly, not node.js backends