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

Function commitAttachRef

code/third-party/public/app.js:10622–10646  ·  view source on GitHub ↗
(finishedWork)

Source from the content-addressed store, hash-verified

10620 }
10621
10622 function commitAttachRef(finishedWork) {
10623 var ref = finishedWork.ref;
10624 if (ref !== null) {
10625 var _instance5 = finishedWork.stateNode;
10626 var instanceToUse = void 0;
10627 switch (finishedWork.tag) {
10628 case HostComponent:
10629 instanceToUse = getPublicInstance(_instance5);
10630 break;
10631 default:
10632 instanceToUse = _instance5;
10633 }
10634 if (typeof ref === 'function') {
10635 ref(instanceToUse);
10636 } else {
10637 {
10638 if (!ref.hasOwnProperty('current')) {
10639 warning(false, 'Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork), getStackAddendumByWorkInProgressFiber(finishedWork));
10640 }
10641 }
10642
10643 ref.current = instanceToUse;
10644 }
10645 }
10646 }
10647
10648 function commitDetachRef(current) {
10649 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