react deprecation_warning ai_generated true

Warning: forwardRef render functions accept exactly two parameters: props and ref

ID: react/forward-ref-deprecation

Also available as: JSON · Markdown
90%Fix Rate
92%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
18 active

Root Cause

forwardRef component has wrong signature or is being deprecated (React 19+ removes it).

generic

Workarounds

  1. 92% success Ensure function takes exactly (props, ref) parameters
    const Input = forwardRef((props, ref) => <input ref={ref} {...props} />);

    Sources: https://react.dev/reference/react/forwardRef

  2. 85% success In React 19+, ref is a regular prop — no need for forwardRef
    function Input({ ref, ...props }) { return <input ref={ref} {...props} />; }

    Sources: https://react.dev/blog/2024/12/05/react-19

Dead Ends

Common approaches that don't work:

  1. Remove forwardRef and pass ref as a regular prop 60% fail

    In React <19, ref is special and won't be forwarded as a prop

Error Chain

Frequently confused with: