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

docs: react related breaking changes #2289

Open
wants to merge 3 commits into
base: next-8-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions docs/plugin-transform-react-jsx.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar_label: transform-react-jsx

### React Automatic Runtime

Automatic runtime is a feature available in v7.9.0. With this runtime enabled, the functions that JSX compiles to will be imported automatically.
The automatic runtime is the default in v8.0.0. When enabled, the functions that Babel compiles JSX to are automatically imported.

**In**

Expand Down Expand Up @@ -251,7 +251,7 @@ With options:
"@babel/plugin-transform-react-jsx",
{
"throwIfNamespace": false, // defaults to true
"runtime": "automatic", // defaults to classic
"runtime": "classic", // defaults to automatic
"importSource": "custom-jsx-library" // defaults to react
}
]
Expand Down Expand Up @@ -320,15 +320,3 @@ Note that the `@jsx React.DOM` pragma has been deprecated as of React v0.12
`string`, defaults to `React.Fragment`.

Replace the component used when compiling JSX fragments.

### `useBuiltIns`

`boolean`, defaults to `false`.

When spreading props, use `Object.assign` directly instead of Babel's extend helper.

### `useSpread`

`boolean`, defaults to `false`.

When spreading props, use inline object with spread elements directly instead of Babel's extend helper or `Object.assign`.
22 changes: 5 additions & 17 deletions docs/preset-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ With options:
[
"@babel/preset-react",
{
"pragma": "dom", // default pragma is React.createElement (only in classic runtime)
"pragmaFrag": "DomFrag", // default is React.Fragment (only in classic runtime)
// "pragma": "dom", // default pragma is React.createElement (only in classic runtime)
// "pragmaFrag": "DomFrag", // default is React.Fragment (only in classic runtime)
"throwIfNamespace": false, // defaults to true
"runtime": "classic" // defaults to classic
// "importSource": "custom-jsx-library" // defaults to react (only in automatic runtime)
"runtime": "automatic", // defaults to automatic
"importSource": "custom-jsx-library" // defaults to react (only in automatic runtime)
}
]
]
Expand All @@ -80,7 +80,7 @@ require("@babel/core").transform("code", {

#### `runtime`

`classic | automatic`, defaults to `classic`
`classic | automatic`, defaults to `automatic`

Decides which runtime to use.

Expand Down Expand Up @@ -126,18 +126,6 @@ Replace the function used when compiling JSX expressions.

Replace the component used when compiling JSX fragments.

#### `useBuiltIns`

`boolean`, defaults to `false`.

Will use the native built-in instead of trying to polyfill behavior for any plugins that require one.

#### `useSpread`

`boolean`, defaults to `false`.

When spreading props, use inline object with spread elements directly instead of Babel's extend helper or `Object.assign`.

### .babelrc.js

```js
Expand Down