Browse Source

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>
main
Indermohan Singh 3 years ago
committed by GitHub
parent
commit
4a7144078c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      content/blog/2022-03-08-react-18-upgrade-guide.md

4
content/blog/2022-03-08-react-18-upgrade-guide.md

@ -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 />);
```

Loading…
Cancel
Save