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

Function commitAttachRef

code/styling/public/app.js:11389–11413  ·  view source on GitHub ↗
(finishedWork)

Source from the content-addressed store, hash-verified

11387 }
11388
11389 function commitAttachRef(finishedWork) {
11390 var ref = finishedWork.ref;
11391 if (ref !== null) {
11392 var _instance5 = finishedWork.stateNode;
11393 var instanceToUse = void 0;
11394 switch (finishedWork.tag) {
11395 case HostComponent:
11396 instanceToUse = getPublicInstance(_instance5);
11397 break;
11398 default:
11399 instanceToUse = _instance5;
11400 }
11401 if (typeof ref === 'function') {
11402 ref(instanceToUse);
11403 } else {
11404 {
11405 if (!ref.hasOwnProperty('current')) {
11406 warning(false, 'Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork), getStackAddendumByWorkInProgressFiber(finishedWork));
11407 }
11408 }
11409
11410 ref.current = instanceToUse;
11411 }
11412 }
11413 }
11414
11415 function commitDetachRef(current) {
11416 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