Skip to content

Commit 4e55cd4

Browse files
committed
Combine createElement and JSX modules
There's a ton of overlap between the createElement implementation and the JSX implementation, so I combined them into a single module. In the actual build output, the shared code between JSX and createElement will get duplicated anyway, because react/jsx-runtime and react (where createElement livs) are separate, flat build artifacts. So this is more about code organization — with a few key exceptions, the implementations of createElement and jsx are highly coupled.
1 parent ec160f3 commit 4e55cd4

File tree

9 files changed

+351
-845
lines changed

9 files changed

+351
-845
lines changed

packages/react-devtools-shared/src/__tests__/utils-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
REACT_SUSPENSE_LIST_TYPE as SuspenseList,
2424
REACT_STRICT_MODE_TYPE as StrictMode,
2525
} from 'shared/ReactSymbols';
26-
import {createElement} from 'react/src/ReactElement';
26+
import {createElement} from 'react';
2727

2828
describe('utils', () => {
2929
describe('getDisplayName', () => {

packages/react/src/ReactChildren.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
} from 'shared/ReactSymbols';
2525
import {checkKeyStringCoercion} from 'shared/CheckStringCoercion';
2626

27-
import {isValidElement, cloneAndReplaceKey} from './ReactElement';
27+
import {isValidElement, cloneAndReplaceKey} from './jsx/ReactJSXElement';
2828

2929
const SEPARATOR = '.';
3030
const SUBSEPARATOR = ':';

packages/react/src/ReactClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
createFactory,
3131
cloneElement,
3232
isValidElement,
33-
} from './ReactElement';
33+
} from './jsx/ReactJSXElement';
3434
import {createContext} from './ReactContext';
3535
import {lazy} from './ReactLazy';
3636
import {forwardRef} from './ReactForwardRef';

packages/react/src/ReactElement.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)