npm install
npm start
lib/index.js
loads the given React component usingvite.ssrLoadModule()
. This evaluates the module server-side and returns the component. This uses the Vite config you have to stay consistent.lib/index.js
then hasGET /payload
endpoint responsible for generating the RSC Payload (0:['$', 'div', null]
) from the component tree and sending it to the client during hydration.- The client (
lib/hydrate.js
) requests the RSC Payload (makes aGET /payload
request) during hydration to render the component tree.
This pipeline has no SSR so the initial HTML is empty, causing the hydration errors. Those have been disabled by not relying on
.hydrateRoot()
but instead using.createRoot()
. It'd be great to introduce SSR as well and use.hydrateRoot()
properly.