Skip to content

Commit

Permalink
style: use createRoot
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Nov 19, 2022
1 parent 38cbe72 commit 0c6ea73
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ yarn add react-monaco-editor

```js
import React from 'react';
import { render } from 'react-dom';
import { createRoot } from "react-dom/client";
import MonacoEditor from 'react-monaco-editor';

class App extends React.Component {
Expand Down Expand Up @@ -76,10 +76,9 @@ class App extends React.Component {
}
}

render(
<App />,
document.getElementById('root')
);
const container = document.getElementById('root');
const root = createRoot(container);
root.render(<App />);
```

Add the [Monaco Webpack plugin](https://github.com/Microsoft/monaco-editor-webpack-plugin) `monaco-editor-webpack-plugin` to your `webpack.config.js`:
Expand Down
6 changes: 4 additions & 2 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { render } from "react-dom";
import { createRoot } from "react-dom/client";
import MonacoEditor, { MonacoDiffEditor } from "react-monaco-editor";

class CodeEditor extends React.Component {
Expand Down Expand Up @@ -204,4 +204,6 @@ const App = () => (
</div>
);

render(<App />, document.getElementById("root"));
const container = document.getElementById("root");
const root = createRoot(container);
root.render(<App />);

0 comments on commit 0c6ea73

Please sign in to comment.