From 1d48b4a68485ce870711e6baa98e5c9f5f213fdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Markb=C3=A5ge?= Date: Sat, 9 Feb 2019 17:12:11 +0000 Subject: [PATCH] Fix hydration with createRoot warning (#14808) It's suggesting an API that doesn't exist. Fixed it to reference the actual API. --- packages/react-dom/src/__tests__/ReactDOMRoot-test.js | 2 +- packages/react-dom/src/client/ReactDOM.js | 2 +- packages/react-dom/src/fire/ReactFire.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-dom/src/__tests__/ReactDOMRoot-test.js b/packages/react-dom/src/__tests__/ReactDOMRoot-test.js index fd6292385b7f4..3ae0414d3cdb0 100644 --- a/packages/react-dom/src/__tests__/ReactDOMRoot-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMRoot-test.js @@ -410,7 +410,7 @@ describe('ReactDOMRoot', () => { // We care about this warning: 'You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.unstable_createRoot(). This is not supported. ' + - 'Did you mean to call root.render(element, {hydrate: true})?', + 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?', // This is more of a symptom but restructuring the code to avoid it isn't worth it: 'Replacing React-rendered children with a new root component.', ], diff --git a/packages/react-dom/src/client/ReactDOM.js b/packages/react-dom/src/client/ReactDOM.js index 80251c2ac2fe7..0eac062bed74f 100644 --- a/packages/react-dom/src/client/ReactDOM.js +++ b/packages/react-dom/src/client/ReactDOM.js @@ -656,7 +656,7 @@ const ReactDOM: Object = { !container._reactHasBeenPassedToCreateRootDEV, 'You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. ' + - 'Did you mean to call root.render(element, {hydrate: true})?', + 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot', ); } diff --git a/packages/react-dom/src/fire/ReactFire.js b/packages/react-dom/src/fire/ReactFire.js index 58a74eba45e92..3e2f00b21f9f6 100644 --- a/packages/react-dom/src/fire/ReactFire.js +++ b/packages/react-dom/src/fire/ReactFire.js @@ -661,7 +661,7 @@ const ReactDOM: Object = { !container._reactHasBeenPassedToCreateRootDEV, 'You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. ' + - 'Did you mean to call root.render(element, {hydrate: true})?', + 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot', ); }