You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the last commit I removed the `ref` property from the element type
completely. Instead, let's keep it for another release cycle but warn
if it's accessed.
In dev, we add a non-enumerable getter with `defineProperty` and warn
whenever it's invoked.
We don't warn on access if a ref is not given. This reduces false
positives in cases where a test serializer uses
`getOwnPropertyDescriptors`` to compare objects, like Jest does, which
is a problem because it bypasses non-enumerability.
So unfortunately this will trigger a false positive warning in Jest when
the diff is printed:
expect(<div ref={ref} />).toEqual(<span ref={ref} />);
A bit sketchy, but this is what we've done for the `props.key` and
`props.ref` accessors for years, which implies it will be good enough
for `element.ref`, too. Let's see if anyone complains.
0 commit comments