GeezerVison is showing github.com — Move createRoot/hydrateRoot to react-dom/client (#23385) · react/react@1780659
File treeExpand file treeCollapse file tree Open diff view settings concurrent/time-slicing/src
react-devtools-extensions react-devtools-shared/src/__tests__ react-interactions/events/src/dom/create-event-handle/__tests__ react-refresh/src/__tests__ react-server-dom-relay/src/__tests__ react-server-dom-webpack/src/__tests__ use-sync-external-store/src/__tests__
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: fixtures/blocks/src/index.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 | */ | 7 | 7 |
| 8 | 8 | import React from 'react'; | 9 | | -import {createRoot} from 'react-dom'; | | 9 | +import {createRoot} from 'react-dom/client'; | 10 | 10 | import './index.css'; | 11 | 11 | import Router from './Router'; | 12 | 12 |
| |
Collapse file Copy file name to clipboardExpand all lines: fixtures/concurrent/time-slicing/src/index.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import React, {PureComponent, unstable_startTransition} from 'react'; | 2 | | -import {createRoot} from 'react-dom'; | | 2 | +import {createRoot} from 'react-dom/client'; | 3 | 3 | import _ from 'lodash'; | 4 | 4 | import Charts from './Charts'; | 5 | 5 | import Clock from './Clock'; | |
Collapse file Copy file name to clipboardExpand all lines: fixtures/ssr/src/index.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import React from 'react'; | 2 | | -import {hydrateRoot} from 'react-dom'; | | 2 | +import {hydrateRoot} from 'react-dom/client'; | 3 | 3 |
| 4 | 4 | import App from './components/App'; | 5 | 5 |
| |
Collapse file Copy file name to clipboardExpand all lines: fixtures/ssr/yarn.lock +9-1Lines changed: 9 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -4265,7 +4265,7 @@ longest@^1.0.1: | 4265 | 4265 | resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" | 4266 | 4266 | integrity sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc= | 4267 | 4267 |
| 4268 | | -loose-envify@^1.0.0: | | 4268 | +loose-envify@^1.0.0, loose-envify@^1.1.0: | 4269 | 4269 | version "1.4.0" | 4270 | 4270 | resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" | 4271 | 4271 | integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== | @@ -5945,6 +5945,14 @@ sax@^1.2.1, sax@~1.2.1: | 5945 | 5945 | resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" | 5946 | 5946 | integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== | 5947 | 5947 |
| | 5948 | +scheduler@^0.20.1: | | 5949 | + version "0.20.2" | | 5950 | + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91" | | 5951 | + integrity sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ== | | 5952 | + dependencies: | | 5953 | + loose-envify "^1.1.0" | | 5954 | + object-assign "^4.1.1" | | 5955 | + | 5948 | 5956 | "semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0: | 5949 | 5957 | version "5.7.1" | 5950 | 5958 | resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" | |
Collapse file Copy file name to clipboardExpand all lines: fixtures/ssr2/src/index.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 | * | 7 | 7 | */ | 8 | 8 |
| 9 | | -import {hydrateRoot} from 'react-dom'; | | 9 | +import {hydrateRoot} from 'react-dom/client'; | 10 | 10 | import App from './App'; | 11 | 11 |
| 12 | 12 | hydrateRoot(document, <App assets={window.assetManifest} />); |
Collapse file Copy file name to clipboardExpand all lines: packages/react-devtools-core/src/standalone.js +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,9 +11,8 @@ import {createElement} from 'react'; | 11 | 11 | import { | 12 | 12 | // $FlowFixMe Flow does not yet know about flushSync() | 13 | 13 | flushSync, | 14 | | - // $FlowFixMe Flow does not yet know about createRoot() | 15 | | - createRoot, | 16 | | -} from 'react-dom'; | | 14 | +} from 'react-dom/client'; | | 15 | +import {createRoot} from 'react-dom/client'; | 17 | 16 | import Bridge from 'react-devtools-shared/src/bridge'; | 18 | 17 | import Store from 'react-devtools-shared/src/devtools/store'; | 19 | 18 | import { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-devtools-core/webpack.standalone.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -64,6 +64,7 @@ module.exports = { | 64 | 64 | react: resolve(builtModulesDir, 'react'), | 65 | 65 | 'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'), | 66 | 66 | 'react-devtools-feature-flags': resolveFeatureFlags(featureFlagTarget), | | 67 | + 'react-dom/client': resolve(builtModulesDir, 'react-dom/client'), | 67 | 68 | 'react-dom': resolve(builtModulesDir, 'react-dom'), | 68 | 69 | 'react-is': resolve(builtModulesDir, 'react-is'), | 69 | 70 | scheduler: resolve(builtModulesDir, 'scheduler'), | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-devtools-extensions/webpack.config.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -76,6 +76,7 @@ module.exports = { | 76 | 76 | react: resolve(builtModulesDir, 'react'), | 77 | 77 | 'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'), | 78 | 78 | 'react-devtools-feature-flags': resolveFeatureFlags(featureFlagTarget), | | 79 | + 'react-dom/client': resolve(builtModulesDir, 'react-dom/client'), | 79 | 80 | 'react-dom': resolve(builtModulesDir, 'react-dom'), | 80 | 81 | 'react-is': resolve(builtModulesDir, 'react-is'), | 81 | 82 | scheduler: resolve(builtModulesDir, 'scheduler'), | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-devtools-inline/README.md +3-5Lines changed: 3 additions & 5 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -60,7 +60,7 @@ const contentWindow = iframe.contentWindow; | 60 | 60 | const DevTools = initialize(contentWindow); | 61 | 61 | ``` | 62 | 62 |
| 63 | | -<sup>3</sup> Because the DevTools interface makes use of several new React APIs (e.g. suspense, concurrent mode) it should be rendered using either `ReactDOM.createRoot` or `ReactDOM.createSyncRoot`. **It should not be rendered with `ReactDOM.render`.** | | 63 | +<sup>3</sup> Because the DevTools interface makes use of several new React APIs (e.g. suspense, concurrent mode) it should be rendered using `ReactDOMClient.createRoot`. **It should not be rendered with `ReactDOM.render`.** | 64 | 64 |
| 65 | 65 | ## Examples | 66 | 66 |
| @@ -110,8 +110,7 @@ const DevTools = initializeFrontend(contentWindow); | 110 | 110 | // as setting the src of the <iframe> would load a new page (without the injected backend). | 111 | 111 |
| 112 | 112 | // <DevTools /> interface can be rendered in the parent window at any time now... | 113 | | -// Be sure to use either ReactDOM.createRoot() | 114 | | -// or ReactDOM.createSyncRoot() to render this component. | | 113 | +// Be sure to use ReactDOMClient.createRoot() to render this component. | 115 | 114 |
| 116 | 115 | // Let the backend know the frontend is ready and listening. | 117 | 116 | activateBackend(contentWindow); | @@ -154,8 +153,7 @@ const { contentWindow } = iframe; | 154 | 153 |
| 155 | 154 | // Initialize DevTools UI to listen to the iframe. | 156 | 155 | // This returns a React component we can render anywhere in the main window. | 157 | | -// Be sure to use either ReactDOM.createRoot() | 158 | | -// or ReactDOM.createSyncRoot() to render this component. | | 156 | +// Be sure to use ReactDOMClient.createRoot() to render this component. | 159 | 157 | const DevTools = initialize(contentWindow); | 160 | 158 |
| 161 | 159 | // Let the backend know to initialize itself. | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-devtools-inline/webpack.config.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -51,6 +51,7 @@ module.exports = { | 51 | 51 | externals: { | 52 | 52 | react: 'react', | 53 | 53 | 'react-dom': 'react-dom', | | 54 | + 'react-dom/client': 'react-dom/client', | 54 | 55 | 'react-is': 'react-is', | 55 | 56 | scheduler: 'scheduler', | 56 | 57 | }, | |
|