3 ms·
Maybe, if you dropped React from RSC, you got only Server component, it means something more generical for you. Now is it just html ? Yup, Html returning from
by revskill 1y ago
Maybe, if you dropped React from RSC, you got only Server component, it means something more generical for you.
Now is it just html ? Yup, Html returning from server is a server component, executed by browser with DOM API (for script tag).
So if you understand Html and JS, you should understand RSC right ?
THe point here is, your html doesn't get rendered on server, your <script> tag doesn't get executed on server.
The server returns a program (code is data) to browser to render the document and execute script.
The real trick, is the server understands the html syntax (using string literal), so you got the illusion of isomorphism between 2 computers.
The server acts as "program generator", the client acts as "program executor".
Ok, it's just one piece of the whole.
The hard trick, is how to keep state preserved between re-rendering.