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

Function imperativeHandleEffect

docs/external/js/react-dom.development.js:15489–15515  ·  view source on GitHub ↗
(create, ref)

Source from the content-addressed store, hash-verified

15487 }
15488
15489 function imperativeHandleEffect(create, ref) {
15490 if (typeof ref === 'function') {
15491 var refCallback = ref;
15492
15493 var _inst = create();
15494
15495 refCallback(_inst);
15496 return function () {
15497 refCallback(null);
15498 };
15499 } else if (ref !== null && ref !== undefined) {
15500 var refObject = ref;
15501
15502 {
15503 if (!refObject.hasOwnProperty('current')) {
15504 error('Expected useImperativeHandle() first argument to either be a ' + 'ref callback or React.createRef() object. Instead received: %s.', 'an object with keys {' + Object.keys(refObject).join(', ') + '}');
15505 }
15506 }
15507
15508 var _inst2 = create();
15509
15510 refObject.current = _inst2;
15511 return function () {
15512 refObject.current = null;
15513 };
15514 }
15515 }
15516
15517 function mountImperativeHandle(ref, create, deps) {
15518 {

Callers

nothing calls this directly

Calls 2

errorFunction · 0.70
createFunction · 0.50

Tested by

no test coverage detected