Skip to content

Commit f6f54b8

Browse files
committed
Combine ReactJSXElementValidator with main module
There are too many layers to the JSX runtime implementation. I think basically everything should be implemented in a single file, so that's what I'm going to do. As a first step, this deletes ReactJSXElementValidator and moves all the code into ReactJSXElement. I can already see how this will help us remove more indirections in the future. Next I'm going to do start moving the `createElement` runtime into this module as well, since there's a lot of duplicated code.
1 parent 14fd963 commit f6f54b8

File tree

4 files changed

+459
-466
lines changed

4 files changed

+459
-466
lines changed

packages/react/src/jsx/ReactJSX.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,21 @@
88
*/
99
import {REACT_FRAGMENT_TYPE} from 'shared/ReactSymbols';
1010
import {
11-
jsxWithValidationStatic,
12-
jsxWithValidationDynamic,
13-
jsxWithValidation,
14-
} from './ReactJSXElementValidator';
15-
import {jsx as jsxProd} from './ReactJSXElement';
16-
const jsx: any = __DEV__ ? jsxWithValidationDynamic : jsxProd;
11+
jsxProd,
12+
jsxProdSignatureRunningInDevWithDynamicChildren,
13+
jsxProdSignatureRunningInDevWithStaticChildren,
14+
jsxDEV as _jsxDEV,
15+
} from './ReactJSXElement';
16+
17+
const jsx: any = __DEV__
18+
? jsxProdSignatureRunningInDevWithDynamicChildren
19+
: jsxProd;
1720
// we may want to special case jsxs internally to take advantage of static children.
1821
// for now we can ship identical prod functions
19-
const jsxs: any = __DEV__ ? jsxWithValidationStatic : jsxProd;
20-
const jsxDEV: any = __DEV__ ? jsxWithValidation : undefined;
22+
const jsxs: any = __DEV__
23+
? jsxProdSignatureRunningInDevWithStaticChildren
24+
: jsxProd;
25+
26+
const jsxDEV: any = __DEV__ ? _jsxDEV : undefined;
2127

2228
export {REACT_FRAGMENT_TYPE as Fragment, jsx, jsxs, jsxDEV};

0 commit comments

Comments
 (0)