Skip to content

Commit

Permalink
Added not about sync/batched root API being required
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Aug 6, 2019
1 parent 2349f04 commit e015e3d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/react-devtools-inline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ activate();
### `react-devtools-inline/frontend`

* **`initialize(contentWindow)`** -
Configures the DevTools interface to listen to the `window` the backend was injected into. This method returns a React component that can be rendered directly.
Configures the DevTools interface to listen to the `window` the backend was injected into. This method returns a React component that can be rendered directly<sup>2</sup>.

```js
import { initialize } from 'react-devtools-inline/frontend';
Expand All @@ -52,6 +52,8 @@ const contentWindow = iframe.contentWindow;
const DevTools = initialize(contentWindow);
```

<sup>2</sup> Because the DevTools interface makes use of several new React APIs (e.g. suspense, concurrent mode) it should be rendered using either `ReactDOM.unstable_createRoot` or `ReactDOM.unstable_createSyncRoot`. It should not be rendered with `ReactDOM.render`.

## Examples

### Configuring a same-origin `iframe`
Expand Down Expand Up @@ -82,6 +84,8 @@ initializeBackend(contentWindow);
const DevTools = initializeFrontend(contentWindow);

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

// Let the backend know the frontend is ready and listening.
activateBackend(contentWindow);
Expand Down Expand Up @@ -124,6 +128,8 @@ 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.unstable_createRoot()
// or ReactDOM.unstable_createSyncRoot() to render this component.
const DevTools = initialize(contentWindow);

// Let the backend know to initialize itself.
Expand Down

0 comments on commit e015e3d

Please sign in to comment.