Skip to content

Commit

Permalink
Update devtools
Browse files Browse the repository at this point in the history
I'm not sure if this is actually right. Relying on CI.
  • Loading branch information
sebmarkbage committed Mar 1, 2022
1 parent ecedff2 commit 1e9a964
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
8 changes: 3 additions & 5 deletions packages/react-devtools-inline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const contentWindow = iframe.contentWindow;
const DevTools = initialize(contentWindow);
```

<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`.**
<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`.**

## Examples

Expand Down Expand Up @@ -110,8 +110,7 @@ const DevTools = initializeFrontend(contentWindow);
// as setting the src of the <iframe> would load a new page (without the injected backend).

// <DevTools /> interface can be rendered in the parent window at any time now...
// Be sure to use either ReactDOM.createRoot()
// or ReactDOM.createSyncRoot() to render this component.
// Be sure to use ReactDOMClient.createRoot() to render this component.

// Let the backend know the frontend is ready and listening.
activateBackend(contentWindow);
Expand Down Expand Up @@ -154,8 +153,7 @@ const { contentWindow } = iframe;

// Initialize DevTools UI to listen to the iframe.
// This returns a React component we can render anywhere in the main window.
// Be sure to use either ReactDOM.createRoot()
// or ReactDOM.createSyncRoot() to render this component.
// Be sure to use ReactDOMClient.createRoot() to render this component.
const DevTools = initialize(contentWindow);

// Let the backend know to initialize itself.
Expand Down
5 changes: 2 additions & 3 deletions packages/react-devtools-shell/src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import {createElement} from 'react';
import {
// $FlowFixMe Flow does not yet know about createRoot()
createRoot,
render,
unmountComponentAtNode,
} from 'react-dom';
} from 'react-dom/client';
import {render, unmountComponentAtNode} from 'react-dom';
import DeeplyNestedComponents from './DeeplyNestedComponents';
import Iframe from './Iframe';
import EditableProps from './EditableProps';
Expand Down
3 changes: 2 additions & 1 deletion packages/react-devtools-shell/src/e2e/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as ReactDOMClient from 'react-dom/client';

const container = document.createElement('div');

Expand All @@ -14,7 +15,7 @@ const container = document.createElement('div');
const App = require('./apps/ListApp').default;

// $FlowFixMe Flow doesn't know about createRoot() yet.
const root = ReactDOM.createRoot(container);
const root = ReactDOMClient.createRoot(container);
root.render(<App />);

// ReactDOM Test Selector APIs used by Playwright e2e tests
Expand Down
3 changes: 2 additions & 1 deletion packages/react-devtools-shell/src/e2e/devtools.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as ReactDOMClient from 'react-dom/client';
import {
activate as activateBackend,
initialize as initializeBackend,
Expand Down Expand Up @@ -33,7 +34,7 @@ function init(appIframe, devtoolsContainer, appSource) {

inject(contentDocument, appSource, () => {
// $FlowFixMe Flow doesn't know about createRoot() yet.
ReactDOM.createRoot(devtoolsContainer).render(
ReactDOMClient.createRoot(devtoolsContainer).render(
<DevTools
hookNamesModuleLoaderFunction={hookNamesModuleLoaderFunction}
showTabBar={true}
Expand Down

0 comments on commit 1e9a964

Please sign in to comment.