mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-24 04:33:10 +00:00
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:
@@ -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 />);
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user