dillon1000/react

Commit

Move ref type check to receiver (#28464)

The runtime contains a type check to determine if a user-provided ref is
a valid type — a function or object (or a string, when
`disableStringRefs` is off). This currently happens during child
reconciliation. This changes it to happen only when the ref is passed to
the component that the ref is being attached to.

This is a continuation of the "ref as prop" change — until you actually
pass a ref to a HostComponent, class, etc, ref is a normal prop that has
no special behavior.
Browse files
Changed paths6 files
First-parent comparison
M packages/react-dom/src/__tests__/ReactComponent-test.js ModifiedM packages/react-dom/src/__tests__/refs-test.js ModifiedM packages/react-reconciler/src/ReactChildFiber.js ModifiedM packages/react-reconciler/src/ReactFiberBeginWork.js ModifiedM packages/react-reconciler/src/__tests__/ReactFiberRefs-test.js ModifiedM scripts/error-codes/codes.json Modified
Patch

Files changed

Rendering syntax-highlighted changes…