Course contentsShow
← React
Lesson 732 of 2,39619. useRefFree lesson

The ref Prop in React 19

How React 19 simplifies ref forwarding by making ref a regular prop without forwardRef.

The ref Prop in React 19

What you'll learn: How React 19 eliminates the need for forwardRef by making ref a regular prop.

The Big Change

In React 19, the entire forwardRef wrapper becomes unnecessary. The ref prop is now treated like any other prop—you can receive it directly in your component's props object and attach it wherever needed.

This is a massive simplification. Remember all that forwardRef ceremony you just learned? In React 19, you can skip it entirely.

Before React 19 (What You Just Learned)

import { forwardRef } from 'react';

const MyInput = forwardRef((props, ref) => {
  return <input ref={ref} {...props} />;
});

Notice the special wrapper and the separate ref parameter.

React 19: ref is Just a Prop

// No forwardRef needed!
function MyInput(props) {
  return <input ref={props.ref} {...props} />;
}

// Or with destructuring
function MyInput({ ref, ...otherProps }) {
  return <input ref={ref} {...otherProps} />;
}

That's it. ref flows through like className, onClick, or any other prop.

Why This Matters

Analogy: Previously, ref was like a VIP that needed a special entrance (forwardRef). Now it walks through the front door with everyone else.

This means:

  • Less boilerplate code
  • No special wrapper imports
  • More consistent mental model
  • ref works exactly like you'd expect props to work

If you're using React 19+, you can essentially forget that forwardRef ever existed for most use cases.

Key Takeaway: React 19 makes ref a regular prop, eliminating the need for forwardRef in typical component ref forwarding scenarios.