Q28: What is React.forwardRef and when is it necessary?

React.forwardRef allows parent components to pass a ref through an intermediate child component down to an underlying real DOM element or child component node.

Key Takeaways
  • Forwards refs down component hierarchies to expose underlying DOM nodes.

  • Essential for reusable design system components requiring DOM focus/measurement.

Knowledge Check

What parameters does a component wrapped in React.forwardRef receive?