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

Function commitAttachRef

code/event-handlers/public/app.js:10719–10743  ·  view source on GitHub ↗
(finishedWork)

Source from the content-addressed store, hash-verified

10717 }
10718
10719 function commitAttachRef(finishedWork) {
10720 var ref = finishedWork.ref;
10721 if (ref !== null) {
10722 var _instance5 = finishedWork.stateNode;
10723 var instanceToUse = void 0;
10724 switch (finishedWork.tag) {
10725 case HostComponent:
10726 instanceToUse = getPublicInstance(_instance5);
10727 break;
10728 default:
10729 instanceToUse = _instance5;
10730 }
10731 if (typeof ref === 'function') {
10732 ref(instanceToUse);
10733 } else {
10734 {
10735 if (!ref.hasOwnProperty('current')) {
10736 warning(false, 'Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork), getStackAddendumByWorkInProgressFiber(finishedWork));
10737 }
10738 }
10739
10740 ref.current = instanceToUse;
10741 }
10742 }
10743 }
10744
10745 function commitDetachRef(current) {
10746 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