RFC: JSX shorthand attributes#121
Conversation
|
JSX suggestions should be reported here: https://github.com/facebook/jsx/ |
@milesj could you please point me to the RFC / Suggestions process for facebook/jsx ? Should I create an Issue there or should I update the Syntax and AST specifications there and send a PR ? |
|
@GnsP Just create an issue there. You'll notice many suggestions already exist as issues there. |
|
(y) Thanks |
|
@GnsP Can you post a link to your new suggestion? Btw, I was also contemplating about this and I like this better inspired by already working |
|
I stick with object spread <Component {...{prop1, prop2}} />It aligns with ReactJS being JS. |
|
Closing since this is about JSX. We're not actively looking at changes to JSX but might at some point revisit all the proposals in this repo for a new revision so don't hesitate to discuss there. |
This RFC proposes a shorthand syntax for passing variables as props, where the variable
name is same as the prop name; similar to the shorthand properties in ES6
object literals.
For example :
<Component prop1={prop1} prop2={prop2} />can be written as<Component +prop1 +prop2 />using the shorthand syntax.This does not require changes to the codebase of React itself. It proposes extending the syntax and semantics of JSX, mainly in transpilers and existing tools