-
-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(transformer/react): isStaticChildren should be false when there i…
…s only one child (#5745) We found a warning report [here](https://github.com/facebook/react/blob/206df66e70652e85711c3177ce1a0459609a7771/packages/react/src/jsx/ReactJSXElement.js#L614-L632). It caused by we transform incorrectly
- Loading branch information
Showing
6 changed files
with
29 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...onformance/tests/babel-plugin-transform-react-jsx/test/fixtures/static-children/input.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div> | ||
{ /* | ||
There is only one child, so the isStaticChildren option should be false. | ||
Please see: https://github.com/facebook/react/blob/206df66e70652e85711c3177ce1a0459609a7771/packages/react/src/jsx/ReactJSXElement.js#L614-L632 | ||
*/} | ||
<div></div> | ||
</div> |
4 changes: 4 additions & 0 deletions
4
...ormance/tests/babel-plugin-transform-react-jsx/test/fixtures/static-children/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"plugins": [["transform-react-jsx-development"]], | ||
"sourceType": "module" | ||
} |
11 changes: 11 additions & 0 deletions
11
...onformance/tests/babel-plugin-transform-react-jsx/test/fixtures/static-children/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var _jsxFileName = "<CWD>/tests/babel-plugin-transform-react-jsx/test/fixtures/static-children/input.jsx"; | ||
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime"; | ||
_jsxDEV("div", { children: _jsxDEV("div", {}, void 0, false, { | ||
fileName: _jsxFileName, | ||
lineNumber: 6, | ||
columnNumber: 3 | ||
}, this) }, void 0, false, { | ||
fileName: _jsxFileName, | ||
lineNumber: 1, | ||
columnNumber: 1 | ||
}, this); |