Skip to content

Commit

Permalink
Combine createElement and JSX modules
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
acdlite committed Feb 13, 2024
1 parent 881e029 commit b71f399
Show file tree
Hide file tree
Showing 9 changed files with 351 additions and 845 deletions.
2 changes: 1 addition & 1 deletion packages/react-devtools-shared/src/__tests__/utils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
REACT_SUSPENSE_LIST_TYPE as SuspenseList,
REACT_STRICT_MODE_TYPE as StrictMode,
} from 'shared/ReactSymbols';
import {createElement} from 'react/src/ReactElement';
import {createElement} from 'react';

describe('utils', () => {
describe('getDisplayName', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/ReactChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
} from 'shared/ReactSymbols';
import {checkKeyStringCoercion} from 'shared/CheckStringCoercion';

import {isValidElement, cloneAndReplaceKey} from './ReactElement';
import {isValidElement, cloneAndReplaceKey} from './jsx/ReactJSXElement';

const SEPARATOR = '.';
const SUBSEPARATOR = ':';
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/ReactClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
createFactory,
cloneElement,
isValidElement,
} from './ReactElement';
} from './jsx/ReactJSXElement';
import {createContext} from './ReactContext';
import {lazy} from './ReactLazy';
import {forwardRef} from './ReactForwardRef';
Expand Down
32 changes: 0 additions & 32 deletions packages/react/src/ReactElement.js

This file was deleted.

Loading

0 comments on commit b71f399

Please sign in to comment.