From 4a7144078ca69f564932167f0a0bbe4e51185d06 Mon Sep 17 00:00:00 2001 From: Indermohan Singh Date: Mon, 11 Apr 2022 20:48:18 +0200 Subject: [PATCH] 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 --- content/blog/2022-03-08-react-18-upgrade-guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/blog/2022-03-08-react-18-upgrade-guide.md b/content/blog/2022-03-08-react-18-upgrade-guide.md index 92fa2933..677682a3 100644 --- a/content/blog/2022-03-08-react-18-upgrade-guide.md +++ b/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(, container, () => { +render(, 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(); ```