Accessing element.ref was removed in React 19 console error #3507
Replies: 1 comment
|
Your diagnosis is right — this is on the library side, not yours. React 19 made // pre-19
const childRef = child.ref;
// 19+
const childRef = child.props.ref;If Tooltip is reading Two things worth checking: Does the tooltip still position correctly? In React 19 Is there already an issue open? Worth a search on the repo before filing, since React 19 compatibility tends to get tracked in one umbrella issue rather than per-component ones. If there isn't one, this belongs in Issues rather than Q&A — you've got a clean reproduction and the root cause identified, which is most of the work done for them. If you need it quiet before they ship a fix, React's own writeup of the change, if useful for the issue: https://react.dev/blog/2024/12/05/react-19#ref-as-a-prop |
Uh oh!
There was an error while loading. Please reload this page.
Using Vibe's Tooltip wrapping a custom component with React.forwardRef (or similar ref-forwarding pattern) triggers this React 19 warning: Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.
Reproduced with Tooltip from @vibe/core V4.5.16 on next@16.3.2 / react@19.x. The internal Tooltip implementation appears to read element.ref off the child (old React <19 pattern) instead of accepting ref as a plain prop, which is deprecated in React 19.
Steps to reproduce:
Render around a component that forwards a ref to a DOM node.
Observe the console error on mount/hover.
All reactions