MCPcopy Create free account
hub / github.com/react/react / coerceRef

Function coerceRef

packages/react-reconciler/src/ReactChildFiber.js:287–295  ·  view source on GitHub ↗
(workInProgress: Fiber, element: ReactElement)

Source from the content-addressed store, hash-verified

285}
286
287function coerceRef(workInProgress: Fiber, element: ReactElement): void {
288 // TODO: This is a temporary, intermediate step. Now that enableRefAsProp is on,
289 // we should resolve the `ref` prop during the begin phase of the component
290 // it's attached to (HostComponent, ClassComponent, etc).
291 const refProp = element.props.ref;
292 // TODO: With enableRefAsProp now rolled out, we shouldn't use the `ref` field. We
293 // should always read the ref from the prop.
294 workInProgress.ref = refProp !== undefined ? refProp : null;
295}
296
297function throwOnInvalidObjectTypeImpl(returnFiber: Fiber, newChild: Object) {
298 if (newChild.$$typeof === REACT_LEGACY_ELEMENT_TYPE) {

Callers 3

updateElementFunction · 0.85
createChildFunction · 0.85
reconcileSingleElementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected