Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JSX] Add <Component {property}> shorthand for <Component property={property}> #5419

Closed
denvned opened this issue Nov 8, 2015 · 2 comments
Closed

Comments

@denvned
Copy link

denvned commented Nov 8, 2015

Currently JSX supports the following syntax:

<Component {...properties}>

That works analogously to ES6:

var object = {...properties};

Below I am proposing to extend this syntax.

In ES6 I can write:

var object = {property};

as a shorthand for:

var object = {property: property};

I think that analogous syntax for JSX would be handy:

<Component {property}>

as a shorthand for:

<Component property={property}>

and also for:

<Component {...{property}}>

Furthermore, allowing the following would be even better:

<Component {propertyA, ...propertySetA, propertyB: valueB, ...propertySetB}>

as a shorthand for:

<Component propertyA={propertyA} {...propertySetA} propertyB={valueB} {...propertySetB}>
@syranide
Copy link
Contributor

syranide commented Nov 9, 2015

Probably best submitted and discussed here: https://github.com/facebook/jsx

@denvned
Copy link
Author

denvned commented Nov 9, 2015

Sorry. Looks like a dup of facebook/jsx#23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants