Replies: 3 comments
-
what you need is described right here: https://react.dev/reference/react-dom/server/renderToReadableStream#rendering-a-react-tree-as-html-to-a-readable-web-stream bootstrapScripts: ['/main.js'] is your missing piece where you can put your code to hydrate client side. In my case it was working as expected. you need to build your main.js before (using bun or another bundler). |
Beta Was this translation helpful? Give feedback.
-
I'm working in a basic approach to use ssr + hydration with react, any pr is welcome |
Beta Was this translation helpful? Give feedback.
-
I went looking for Bun RSC support after reading Dan Abramov's new article here: Looks like Parcel is shipping with RSC support now https://parceljs.org/recipes/rsc so hopefully Bun's bundler adds official support soon. |
Beta Was this translation helpful? Give feedback.
-
Does anyone have a good example of how best to set up a Bun server to stream server-side React components while also hydrating client-side React? I'm looking for a concrete example of what @Jarred-Sumner demonstrates in this talk.
Currently, my simple bun server looks like this:
This works great for rendering server-side components, but I don't get any client-side functionality in my "client" components (state, etc.).
I'm looking to achieve something like this:

PS. I'm specifically trying to use a Bun server for this. I am not looking to run a framework (NextJS) with the
bun
command. Lots of solutions I've found online for setting up a web app with RSC in Bun start with some form of "just install NextJS, then runbun run dev
!"...Beta Was this translation helpful? Give feedback.
All reactions