janestreet / incr_dom

A library for building dynamic webapps, using Js_of_ocaml.
MIT License
381 stars 32 forks source link

Define recipe for a server-side render #14

Open cdaringe opened 3 years ago

cdaringe commented 3 years ago

Problem

examples/ have excellent content for defining client side applications. I am interested in the classico isomorphic SSR + hydrate/re-render in browser paradigm (e.g. next.js), and it seems like a well defined set of function calls in the incr_dom world could enable this.

There's clearly more involved here, but OCaml community I don't think has a killer solve for this yet, even though all of the capabilities are there. Additionally, I do see that there's some work going into bonsai ATM by incr_dom contributors. Aside, should incr_dom users continue to expect development here, or really only be expecting new work (maintenance, features, etc) to be flowing from that project?

Thanks!

TyOverby commented 3 years ago

At the moment, it is not possible for any Incr_dom content to be rendered serverside because the virtual-dom library that we rely on is javascript-only. We are planning on making a pure-OCaml version replacement though, so that might become an option sometime in the future.

Additionally, I do see that there's some work going into bonsai ATM by incr_dom contributors. Aside, should incr_dom users continue to expect development here, or really only be expecting new work (maintenance, features, etc) to be flowing from that project?

That's correct, Bonsai is built on top of Incr_dom, so changes to Incr_dom nowadays are largely going to be due to requirements for Bonsai. Incr_dom is maintained, but also quite stable. Most of the improvements that I've wanted to make it were of the form "this boilerplate shouldn't be necessary if the right abstractions were in place", which is what the Bonsai project is all about.

Hope that answers your questions!