mediaRef
Type:
<object> | <function>
It returns the DOM reference used for mounting the internal media component.
Depending on your implementation and requirements, the way you'd use this property can vary.
with useRef
If you don't need the ref "on mount" (eg. for attaching callbacks), React's
useRef
hook alone will suffice:with useCallback & useRef
If you need access to the media DOM element on mount, you would want to use the
useCallback
hook. This solution is explained briefly in the React FAQ's
, and in a bit more detail in this
popular Medium post: