fix the code block for AppWithCallbackAfterRender (#4571)

* fix the code block for AppWithCallbackAfterRender

fix the code block for AppWithCallbackAfterRender by using createRoot method from 'react-dom/client'

* Update 2022-03-08-react-18-upgrade-guide.md

Co-authored-by: dan <dan.abramov@gmail.com>
This commit is contained in:
Indermohan Singh
2022-04-11 20:48:18 +02:00
committed by GitHub
parent 84ad330833
commit 4a7144078c

View File

@@ -60,7 +60,7 @@ We've also removed the callback from render, since it usually does not have the
```js
// Before
const container = document.getElementById('app');
ReactDOM.render(<App tab="home" />, container, () => {
render(<App tab="home" />, container, () => {
console.log('rendered');
});
@@ -74,7 +74,7 @@ function AppWithCallbackAfterRender() {
}
const container = document.getElementById('app');
const root = ReactDOM.createRoot(container);
const root = createRoot(container);
root.render(<AppWithCallbackAfterRender />);
```