MCPcopy Index your code
hub / github.com/microsoft/SandDance / commitAttachRef

Function commitAttachRef

docs/external/js/react-dom.development.js:20141–20169  ·  view source on GitHub ↗
(finishedWork)

Source from the content-addressed store, hash-verified

20139 }
20140
20141 function commitAttachRef(finishedWork) {
20142 var ref = finishedWork.ref;
20143
20144 if (ref !== null) {
20145 var instance = finishedWork.stateNode;
20146 var instanceToUse;
20147
20148 switch (finishedWork.tag) {
20149 case HostComponent:
20150 instanceToUse = getPublicInstance(instance);
20151 break;
20152
20153 default:
20154 instanceToUse = instance;
20155 } // Moved outside to ensure DCE works with this flag
20156
20157 if (typeof ref === 'function') {
20158 ref(instanceToUse);
20159 } else {
20160 {
20161 if (!ref.hasOwnProperty('current')) {
20162 error('Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork.type), getStackByFiberInDevAndProd(finishedWork));
20163 }
20164 }
20165
20166 ref.current = instanceToUse;
20167 }
20168 }
20169 }
20170
20171 function commitDetachRef(current) {
20172 var currentRef = current.ref;

Callers 1

commitLayoutEffectsFunction · 0.85

Calls 5

getPublicInstanceFunction · 0.85
refFunction · 0.70
errorFunction · 0.70
getComponentNameFunction · 0.70

Tested by

no test coverage detected