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

Add option to preset-react / transform-react-jsx to output object spread syntax #9652

Open
Jessidhia opened this Issue Mar 8, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@Jessidhia
Copy link
Member

Jessidhia commented Mar 8, 2019

Feature Request

Is your feature request related to a problem? Please describe.
Currently, transform-react-jsx either outputs uses of the extend helper or calls to Object.assign for handling spread props (any attribute with {...Expression}).

Describe the solution you'd like
An option to instead convert such instances to an inline object with spread elements.

This would still allow @babel/preset-env to further transform the inline object if the allowed targets don't support object spread.

Teachability, Documentation, Adoption, Migration Strategy
If it wasn't a semver-major change I'd be as bold as to say that it's safe to make it enabled by default -- I suspect almost no project runs @babel/preset-react without also using @babel/preset-env, and native object rest spread has been supported by it even without requiring the shippedProposals option. It has also been shipping on browsers and node (LTS, even) for over a year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.