Closed
Description
JSX:
<button type_="button" />
Compiles to:
var React = require("react");
React.createElement("button", {
type: "button"
});
external
:
type t;
[@bs.obj] external make: (~_type: string) => t = "";
let x = make(~_type="x");
Compiles to:
var x = {
type: "x"
};
But when bindings to React components meet external
, it's required to use prefix form:
module X = {
[@react.component] [@bs.module "x"]
external make: (~_type: string) => React.element = "X";
};
So on the call site it's:
<button type_="button" />
<X _type="x" />