Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

react: Use babel-preset-react's new useSpread option #1488

Merged
merged 1 commit into from Nov 10, 2019
Merged

react: Use babel-preset-react's new useSpread option #1488

merged 1 commit into from Nov 10, 2019

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented Nov 10, 2019

A new useSpread option was added in Babel 7.7.0 (babel/babel#10572), which supersedes the babel-preset-react's existing useBuiltIns option:
https://babeljs.io/docs/en/babel-preset-react#usespread

Enabling this means that the JSX-> JS conversion will use an inline object with spread elements (for code that spreads props), rather than Babel's extend helper or Object.assign.

@babel/env will still transpile these down if required for the target browsers (the only reason useSpread is not already enabled by default is that for the upstream project this is a breaking change, since they cannot assume that users of babel-preset-react are always using it alongside @babel/env, even though most likely are).

A new `useSpread` option was added in Babel 7.7.0 (babel/babel#10572):
https://babeljs.io/docs/en/babel-preset-react#usespread

Enabling this means that the JSX-> JS conversion will use an inline
object with spread elements (for code that spreads props), rather than
Babel's extend helper or `Object.assign`.

`@babel/env` will still transpile these down if required for the target
browsers (the only reason `useSpread` is not already enabled by default
is that for the upstream project this is a breaking change, since they
cannot assume that users of `babel-preset-react` are always using it
alongside `@babel/env`, even though most likely are).
@edmorley edmorley added this to the Neutrino 9 milestone Nov 10, 2019
@edmorley edmorley self-assigned this Nov 10, 2019
@edmorley edmorley requested a review from a team November 10, 2019 15:27
Copy link
Member

@helfi92 helfi92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@edmorley edmorley merged commit 4bd2031 into neutrinojs:master Nov 10, 2019
@edmorley edmorley deleted the react-babel-useSpread branch November 10, 2019 15:50
@edmorley
Copy link
Member Author

Thank you for the review :-)

Copy link

@chiccogirl chiccogirl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hhhh

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants