forwardRef lets your component expose a DOM node to parent component with a ref.
Parent component can access child component's ref if child component is wrapped with forwardRef.
Without using forwardRef, child component's ref can't be accessed from parent component.
It's like how closure gives you access to an outer function from an inner function. Not really, but kind of the same concept.
In example code below,
<ParentComponent> has access to it's own ref (parentInputRef).
<ParentComponent> also has access to <ChildComponentWithForwardRef> ref (childForwardRef).
<ParentComponent> doesn't has access to <ChildComponentWithoutForwardRef> ref (childWithoutForwardRef).
Uncaught TypeError: Cannot read properties of null (reading 'value')