Skip to content

.tip

· one of the small things

In React 19, ref is just a prop

You don't need forwardRef any more. A function component gets ref like any other prop.

function Input({ ref, ...props }: React.ComponentProps<"input">) {
  return <input ref={ref} {...props} />;
}

Existing forwardRef code still works, and there's a codemod that removes it. New components should just take the prop.

react