Open
Description
Right now, we use a JavaScript object to convert from labelled arguments to a single value, so that the component implementation can receive them from ReactJS:
Lines 563 to 569 in d7290d3
However, this approach leads to generated code like:
function make$2(className, onClick, disabled, children, key, param) {
var
_a_ = caml_call2(Stdlib_Option[7], caml_jsstring_of_string, key),
_b_ =
{
"key": caml_call1(Js_of_ocaml_Js[6][9], _a_),
"children": children,
"disabled": disabled,
"onClick": onClick,
"className": className
};
return caml_call2(React[12], make$1, _b_)
}
This leads to larger bundle size as minifiers are not able to remove the string constants in the props object.
There might be a work around that involves passing an array instead of an object. The only constraint is that this array has to be written and read in a consistent order, but because ppx has full knowledge about this, it should be feasible.