Forward a DOM reference to another Component using forwardRef in React 16.3

InstructorNik Graf

Share this video with your friends

Send Tweet

The function forwardRef allows us to extract a ref and pass it to its descendants. This is a powerful tool, but should be used with caution to avoid unexpected ref behaviour. The technique of forwarding refs really starts to shine in combination with higher order components (HOCs).