PoC for Render Props composition


Right now Render Props are the best way to reuse functionality in ReasonReact. But when you have a bunch of them to use the code starts to get really hard to read and move stuff.
Here’s our proposal and PoC for a possible solution leveraging CPS sugar concept.

Read more about it here


This looks really interesing! If I understand it correctly, it is indeed a problem I’ve been experiencing as well.

Do you have any examples of the same code with and without Epitath? Might make it clearer what it’s actually doing.


Yes, I have @RasmusKlett. What it basically does is wrap the “callbacks” for you, much like what happens when await/async desugars.

  ...(result => <Content />)

can be used as

let%Epitath result = children => <Query> ...children </Query>;

Epitath takes care of explaining to let-anything how to pass the continuation callback to the Query RenderProp

much like

API.call() |> Js.Promise.then_(result => continuation)


let%Await result = API.call();


That is just what I was hoping for, I will definitely use this! My gut feeling is that this does satisfy the monad laws, have you verified this?

The syntax is a little noisy though. Could it be simplified by avoiding JSX, and using currying to avoid having to explicitly pass the children? I don’t quite get how Reason JSX works, so maybe I’m completely off the mark. It would be so cool if the syntax could just be

let%Epitath result = Query

Or even needing a wrapper function around Query would be an improvement I think.