-
Notifications
You must be signed in to change notification settings - Fork 46.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let ReactDOM initialize in RSC (#25503)
With the `react-dom/server-rendering-stub` you can import `react-dom` in RSC so that you can call `preload` and `preinit` but if you don't alias it, then requiring it breaks because we React.Component which doesn't exist in the react subset.
- Loading branch information
1 parent
1f7a2f5
commit 79c5829
Showing
5 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
packages/react-dom/src/__tests__/ReactDOMInReactServer-test.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,24 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @emails react-core | ||
*/ | ||
|
||
'use strict'; | ||
|
||
describe('ReactDOMInReactServer', () => { | ||
beforeEach(() => { | ||
jest.resetModules(); | ||
jest.mock('react', () => require('react/react.shared-subset')); | ||
}); | ||
|
||
// @gate experimental && !www | ||
it('can require react-dom', () => { | ||
// In RSC this will be aliased. | ||
require('react'); | ||
require('react-dom'); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
export * from './src/ReactSharedSubset'; |
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