Open jchavarri opened 2 years ago
One downside of the suggested improvement is that React Dev Tools won't be showing the props as an object as it does now. Maybe this could be an option that activates or not depending on the "developer" or "release" profile modes 🤔
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:
https://github.com/ml-in-barcelona/jsoo-react/blob/d7290d38fddfdfb0da41aa2e71f0974a83061ec7/ppx/ppx.ml#L563-L569
However, this approach leads to generated code like:
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.