SIGN IN SIGN UP

Convert string ref props to callback props (#28398)

When enableRefAsProp is on, we should always use the props as the source
of truth for refs. Not a field on the fiber.

In the case of string refs, this presents a problem, because string refs
are not passed around internally as strings; they are converted to
callback refs. The ref used by the reconciler is not the same as the one
the user provided.

But since this is a deprecated feature anyway, what we can do is clone
the props object and replace it with the internal callback ref. Then we
can continue to use the props object as the source of truth.

This means the internal callback ref will leak into userspace. The
receiving component will receive a callback ref even though the parent
passed a string. Which is weird, but again, this is a deprecated
feature, and we're only leaving it around behind a flag so that Meta can
keep using string refs temporarily while they finish migrating their
codebase.
A
Andrew Clark committed
dc30644ca77e52a2760e81fbdbcfbd2f2fd4979c
Parent: ddd736d
Committed by GitHub <noreply@github.com> on 2/21/2024, 4:41:29 PM