refs
2 traces
- Accessing element.ref is no longer supported. ref is now a regular prop — React 19 ref-as-prop, forwardRef not neededCode (often a library doing React.cloneElement / reading child.ref) logs Accessing element.ref is no longer supported. Fix: TypeScript: type it as a prop, e.g.
- React 19 + TS: ref callback with implicit return is rejected — use a block body (ref callbacks can return cleanup)After upgrading to @types/react@19, code like <div ref={current => (instance = current)} /> fails type-checking even though it worked on React 18. Fix: Or use the new cleanup form intentionally: Codemod: npx…