Support for props spread
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 10.3k
- Forks
- 438
- PR merge metrics
- No merged PRs in 30d
Description
Support for this syntax would be helpful for ReasonReact:
<div {...props} />
Conceptually it maps to a component whose total set of props has been created elsewhere. I'd propose that it could desugar to:
let _ = ((div props)[@JSX ])
Importantly - I don't think that it's useful or interesting (for the purposes of ReasonReact at least) to support props spread+individual props. I am not asking for support for either of:
<div {...props} somethingElse=1 />;
<div {...props}> somethingElse </div>
For context on why I want this - today RR components are a set of two functions - x and xProps in the same module scope. Sometimes folks want to (or can only) make a component which is just x. This syntax allows them to do so and get the props through any means that they'd like while still being able to use JSX.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No implementation files, tests, or entry points are named. Start by locating the Reason/OCaml JSX parsing and desugaring code, then trace how a standalone props spread is represented. Done means the proposed <div {...props} /> form works while spread combined with individual props remains unsupported, with regression coverage for both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100