reasonml / reasonml/reason

Support Custom Elements in JSX

Open
#2,344 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

KIND: FEATURE REQUEST
Dominant language
OCaml
Stars
10.3k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points; start by reproducing the shown case in the Reason JSX PPX. Done means the example compiles and supports a hyphenated custom-element name, with regression coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
compilers
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.