reason icon indicating copy to clipboard operation
reason copied to clipboard

Support for props spread

Open rickyvetter opened this issue 4 years ago • 0 comments

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.

rickyvetter avatar May 05 '20 18:05 rickyvetter