BuckleScript bindings for ReactJS components with ReactJS children



I am trying to build BuckleScript bindings for a ReactJS library that has a lot of ReactJS components accepting other ReactJS components as children. My first attempt at building the bindings is to create a binding for the parent element and for the child element, but then when the app runs, the parent element receives the ReasonReact version of the children instead of the ReactJS version and the app breaks. Any ideas on the proper way to build this? Should I convert the ReasonReact component back into ReactJS?


/* MyComponent.re */
let component = ReasonReact.statelessComponent("MyComponent.re");

let make = _children => { 
  render: _self => 
/* BsMyReactJsLibrary/src/Child.re */
[@bs.module "my-react-js-library"]
  external reactJsChild : ReasonReact.reactClass = "ReactJsChild";
let make = (...) => ReasonReact.wrapJsForReason(...);


Never mind on this one. I had an error in the make function and I misinterpreted the failure. I forgot to pass the unit value to terminate the function with labeled arguments. In the compiled JavaScript, BuckleScript was returning a function instead of an object.

[@bs.obj] external makeProps : (
  ~someValue: string=?,
) => _ = "";

let make = (
) =>
    () /* this is the line I forgot to include in the original broken code */