MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / commitAttachRef

Function commitAttachRef

code/communication/public/app.js:11424–11448  ·  view source on GitHub ↗
(finishedWork)

Source from the content-addressed store, hash-verified

11422 }
11423
11424 function commitAttachRef(finishedWork) {
11425 var ref = finishedWork.ref;
11426 if (ref !== null) {
11427 var _instance5 = finishedWork.stateNode;
11428 var instanceToUse = void 0;
11429 switch (finishedWork.tag) {
11430 case HostComponent:
11431 instanceToUse = getPublicInstance(_instance5);
11432 break;
11433 default:
11434 instanceToUse = _instance5;
11435 }
11436 if (typeof ref === 'function') {
11437 ref(instanceToUse);
11438 } else {
11439 {
11440 if (!ref.hasOwnProperty('current')) {
11441 warning(false, 'Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork), getStackAddendumByWorkInProgressFiber(finishedWork));
11442 }
11443 }
11444
11445 ref.current = instanceToUse;
11446 }
11447 }
11448 }
11449
11450 function commitDetachRef(current) {
11451 var currentRef = current.ref;

Callers 1

commitAllLifeCyclesFunction · 0.70

Calls 4

warningFunction · 0.85
refFunction · 0.70
getComponentNameFunction · 0.70

Tested by

no test coverage detected