Fix parameters or JSX dev runtime #3880
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
isStaticChildren: boolean
), which is not useful*, but is still being passedsource
andself
again (incorrectly introduced in Fix swapped jsx runtime__source
and__self
arguments #3459)My guess is that the previous PR “fixed” the earlier problem because
self
isn’t used, so by callingisStaticChildren
“self
”, a bug went away.The source for where this
jsxDEV
call is generated in Babel is here: https://github.com/babel/babel/blob/3952486/packages/babel-plugin-transform-react-jsx/src/create-plugin.ts#L506-L508.The React RFC for the transform that mentions the dev runtime is here: https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md#dev-only-transforms.
React’s implementation is here: https://github.com/facebook/react/blob/855b77c9bbee347735efcd626dda362db2ffae1d/packages/react/src/jsx/ReactJSXElementValidator.js#L306-L311
*
isStaticChildren
is the same as whetherjsxs
would be used, instead ofjsx
. Which is also whether there are 2 or more children passed:<a />
->jsx('a', {})
<a>b</a>
->jsx('a', {children: 'b'})
<a>{1}{2}</a>
->jsxs('a', {children: [1, 2]})
Related-to: GH-3459.