From c10b3f789c5cf2a219c9523e59f6a9fed52e759b Mon Sep 17 00:00:00 2001 From: alireza molaee Date: Tue, 5 Apr 2022 06:26:18 +0430 Subject: [PATCH] Fix false positive warning about react-dom/client with UMD builds (#24274) --- packages/react-dom/src/client/ReactDOM.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-dom/src/client/ReactDOM.js b/packages/react-dom/src/client/ReactDOM.js index 33e46d37a775..aaf429cad54c 100644 --- a/packages/react-dom/src/client/ReactDOM.js +++ b/packages/react-dom/src/client/ReactDOM.js @@ -152,7 +152,7 @@ function createRoot( options?: CreateRootOptions, ): RootType { if (__DEV__) { - if (!Internals.usingClientEntryPoint) { + if (!Internals.usingClientEntryPoint && !__UMD__) { console.error( 'You are importing createRoot from "react-dom" which is not supported. ' + 'You should instead import it from "react-dom/client".', @@ -168,7 +168,7 @@ function hydrateRoot( options?: HydrateRootOptions, ): RootType { if (__DEV__) { - if (!Internals.usingClientEntryPoint) { + if (!Internals.usingClientEntryPoint && !__UMD__) { console.error( 'You are importing hydrateRoot from "react-dom" which is not supported. ' + 'You should instead import it from "react-dom/client".',