MCPcopy Create free account
hub / github.com/reactjs/react-rails / hydrate

Function hydrate

lib/assets/react-source/development/react.js:28502–28519  ·  view source on GitHub ↗
(element, container, callback)

Source from the content-addressed store, hash-verified

28500 }
28501 }
28502 function hydrate(element, container, callback) {
28503 if (!isValidContainer(container)) {
28504 {
28505 throw Error( "Target container is not a DOM element." );
28506 }
28507 }
28508
28509 {
28510 var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined;
28511
28512 if (isModernRoot) {
28513 error('You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. ' + 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?');
28514 }
28515 } // TODO: throw or warn if we couldn't hydrate?
28516
28517
28518 return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
28519 }
28520 function render(element, container, callback) {
28521 if (!isValidContainer(container)) {
28522 {

Callers

nothing calls this directly

Calls 4

isValidContainerFunction · 0.85
isContainerMarkedAsRootFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected