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

Function commitAttachRef

code/dependency-injection/public/app.js:11482–11506  ·  view source on GitHub ↗
(finishedWork)

Source from the content-addressed store, hash-verified

11480 }
11481
11482 function commitAttachRef(finishedWork) {
11483 var ref = finishedWork.ref;
11484 if (ref !== null) {
11485 var _instance5 = finishedWork.stateNode;
11486 var instanceToUse = void 0;
11487 switch (finishedWork.tag) {
11488 case HostComponent:
11489 instanceToUse = getPublicInstance(_instance5);
11490 break;
11491 default:
11492 instanceToUse = _instance5;
11493 }
11494 if (typeof ref === 'function') {
11495 ref(instanceToUse);
11496 } else {
11497 {
11498 if (!ref.hasOwnProperty('current')) {
11499 warning(false, 'Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork), getStackAddendumByWorkInProgressFiber(finishedWork));
11500 }
11501 }
11502
11503 ref.current = instanceToUse;
11504 }
11505 }
11506 }
11507
11508 function commitDetachRef(current) {
11509 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