Lesson 6
The Death of forwardRef
ref as a Prop
The Shift: For years, passing a ref to a child component was a nightmare. You had to wrap the child in forwardRef and separate the arguments. React 19 treats ref just like any other prop.
👀 Preview
Refs can now be passed as regular props, eliminating the need for forwardRef wrapper.
📚 Explanation
In React 19, `ref` is treated as a regular prop. You can destructure it from props just like any other prop, eliminating the need for `forwardRef`. This simplifies component APIs and makes refs easier to work with.
App.tsx
How well did you remember this?