From b5fd1df671f480b83384298a92bfa44a02b9c583 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 30 Mar 2022 03:38:02 +0100 Subject: [PATCH] Add a note about Strict Mode to release blog post (#4521) * Add a note about Strict Mode to release blog post * Update 2022-03-08-react-18-upgrade-guide.md * Update 2022-03-08-react-18-upgrade-guide.md --- content/blog/2022-03-08-react-18-upgrade-guide.md | 10 ++++++++-- 1 file changed, 8 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 ec213fae..d75cb101 100644 --- a/content/blog/2022-03-08-react-18-upgrade-guide.md +++ b/content/blog/2022-03-08-react-18-upgrade-guide.md @@ -70,7 +70,7 @@ function AppWithCallbackAfterRender() { console.log('rendered'); }); -return + return } const container = document.getElementById('app'); @@ -78,7 +78,9 @@ const root = ReactDOM.createRoot(container); root.render(); ``` -> Note: There is no one-to-one replacement for the old render callback API — it depends on your use case. See the working group post for [Replacing render with createRoot](https://github.com/reactwg/react-18/discussions/5) for more information. +> Note: +> +> There is no one-to-one replacement for the old render callback API — it depends on your use case. See the working group post for [Replacing render with createRoot](https://github.com/reactwg/react-18/discussions/5) for more information. Finally, if your app uses server-side rendering with hydration, upgrade `hydrate` to `hydrateRoot`: @@ -97,6 +99,10 @@ const root = hydrateRoot(container, ); For more information, see the [working group discussion here](https://github.com/reactwg/react-18/discussions/5). +> Note +> +> **If your app doesn't work after upgrading, check whether it's wrapped in ``.** [Strict Mode has gotten stricter in React 18](#updates-to-strict-mode), and not all your components may be resilient to the new checks it adds in development mode. If removing Strict Mode fixes your app, you can remove it during the upgrade, and then add it back (either at the top or for a part of the tree) after you fix the issues that it's pointing out. + ## Updates to Server Rendering APIs {#updates-to-server-rendering-apis} In this release, we’re revamping our `react-dom/server` APIs to fully support Suspense on the server and Streaming SSR. As part of these changes, we're deprecating the old Node streaming API, which does not support incremental Suspense streaming on the server.