reasonml / reason-react

Reason bindings for ReactJS
https://reasonml.github.io/reason-react/
MIT License
3.25k stars 347 forks source link

Proposal: native compat library for syncing with server-reason-react #807

Closed jchavarri closed 10 months ago

jchavarri commented 10 months ago

As server-reason-react is mirroring the API of reason-react, it becomes challenging to keep up over there with the changes done here.

We also don't want to remove the external declarations used on react.rei for performance reasons.

So the solution is to create a second react.rei that is used purely for syncing purposes with server-reason-react, until we have virtual libraries or better support for this. See companion PR https://github.com/ml-in-barcelona/server-reason-react/pull/82.

jchavarri commented 10 months ago

Talked to @davesnx offline and we decided to explore a different path, where we use server-reason-react.melange.ppx which is already removing the differences between melange and native, to process react.rei and convert externals into regular let definitions, e.g.

[@mel.module "react"]
external useMemo: ([@mel.uncurry] (unit => 'any)) => 'any = "useMemo";

into

let useMemo: (unit => 'any) => 'any;

That way, we might be able to start working towards a reason-react virtual library that includes the mli "as is" currently.