MCPcopy
hub / github.com/tastejs/todomvc / commitAttachRef

Function commitAttachRef

examples/typescript-react/js/bundle.js:17192–17216  ·  view source on GitHub ↗
(finishedWork)

Source from the content-addressed store, hash-verified

17190}
17191
17192function commitAttachRef(finishedWork) {
17193 var ref = finishedWork.ref;
17194 if (ref !== null) {
17195 var instance = finishedWork.stateNode;
17196 var instanceToUse = void 0;
17197 switch (finishedWork.tag) {
17198 case HostComponent:
17199 instanceToUse = getPublicInstance(instance);
17200 break;
17201 default:
17202 instanceToUse = instance;
17203 }
17204 if (typeof ref === 'function') {
17205 ref(instanceToUse);
17206 } else {
17207 {
17208 if (!ref.hasOwnProperty('current')) {
17209 warningWithoutStack$1(false, 'Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork.type), getStackByFiberInDevAndProd(finishedWork));
17210 }
17211 }
17212
17213 ref.current = instanceToUse;
17214 }
17215 }
17216}
17217
17218function commitDetachRef(current$$1) {
17219 var currentRef = current$$1.ref;

Callers 1

commitAllLifeCyclesFunction · 0.85

Calls 4

getPublicInstanceFunction · 0.85
refFunction · 0.85
getComponentNameFunction · 0.85

Tested by

no test coverage detected