>Can this be run in any other back end other than Node since it only transmits a stream of serialized vdom? React components themselves are JS so we'd expect the backend to be in JS. (I mean, you could reimplement it in Rust or something, but then you can't easily move components to the Client and back.) There is no hard dependency on Node.js itself — as long as your JS environment has some sort of streams, we could make it work.
Perhaps with hiccup we could make it work sans JS
i think something more like React elements would be a good general lib in Clojure 🙂 but hiccup could compile to it
(defrecord Element [type props key])
I think the hard part would also be coming up with a stream api
Would you have the clojure code write progress to a core async channel?
They're doing something funky (concurrent mode?) To make that stream
Well they’re using Suspense and Concurrent mode to also make the async stuff look synchronous, so that React can move on to render other bits and stream them.
TBH, it looks to me that this is some complex machinery for an often talked about, but kind of niche use case.
I assume they're using either websockets or a streaming HTTP response
so we'd want to use whatever Clojure solution solves that problem
using core.async, manifold, etc. seems like an implementation detail
you're right though that replicating their machinery for suspending on the server will be difficult
I'm thinking more about what that actually looks like. I know they throw a promise and then retry later under the hood, and we could do that. But it still feels weird.
Maybe a go
-like macro :P