reason
reason copied to clipboard
Support Custom Elements in JSX
It is not currently possible to use a Reason's JSX syntax to create a custom element. E.g. this won't compile:
/* JavaScript code executed somewhere before our Reason's JSX */
customElements.define("example-component", ...);
/* Reason JSX */
<example-component></example-component>
It doesn't compile because of a hyphen - in the component name. However, this hyphen is actually mandatory. Without the hyphen, .define() throws. As MDN puts it:
Name for the new custom element. Note that custom element names must contain a hyphen.
(source).
Also note that JSX in JavaScript does allow hyphens and thus works with custom elements.
Thus I think Reason's JSX ppx should handle this case.