Fix hydration with createRoot warning (#14808)
It's suggesting an API that doesn't exist. Fixed it to reference the actual API.
Sebastian Markbåge committed
Feb 9, 2019 at 17:12 UTC
1d48b4a68485ce870711e6baa98e5c9f5f213fdf
3 files changed
+3
-3
packages/react-dom/src/__tests__/ReactDOMRoot-test.js
+1
-1
@@ -410,7 +410,7 @@ describe('ReactDOMRoot', () => {
410
// We care about this warning:
411
'You are calling ReactDOM.hydrate() on a container that was previously ' +
412
'passed to ReactDOM.unstable_createRoot(). This is not supported. ' +
413
- 'Did you mean to call root.render(element, {hydrate: true})?',
413
+ 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?',
414
// This is more of a symptom but restructuring the code to avoid it isn't worth it:
415
'Replacing React-rendered children with a new root component.',
416
],
packages/react-dom/src/client/ReactDOM.js
+1
-1
@@ -656,7 +656,7 @@ const ReactDOM: Object = {
656
!container._reactHasBeenPassedToCreateRootDEV,
657
'You are calling ReactDOM.hydrate() on a container that was previously ' +
658
'passed to ReactDOM.%s(). This is not supported. ' +
659
- 'Did you mean to call root.render(element, {hydrate: true})?',
659
+ 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?',
660
enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot',
661
);
662
}
packages/react-dom/src/fire/ReactFire.js
+1
-1
@@ -661,7 +661,7 @@ const ReactDOM: Object = {
661
!container._reactHasBeenPassedToCreateRootDEV,
662
'You are calling ReactDOM.hydrate() on a container that was previously ' +
663
'passed to ReactDOM.%s(). This is not supported. ' +
664
- 'Did you mean to call root.render(element, {hydrate: true})?',
664
+ 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?',
665
enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot',
666
);
667
}