Closed bedrich-schindler closed 2 years ago
Maybe we could change the implementation to remove forwardedRef
from props and pass it by context.
We already use this for internal things in:
FormLayout
(src/lib/components/FormLayout/FormLayoutContext.js
)Button
in ButtonGroup
(src/lib/components/ButtonGroup/ButtonGroupContext.js)Good catch @bedrich-schindler!
@mbohal Yeah, it should work. I would try it this way, if @adamkudrna agrees
Please don't forget to update docs, e.g. in Popover
:
Aslo we need to make sure that the transferProps
position is correct.
I would like to clarify following:
ref
is prop used to reference origin HTML component.forwardedRef
is prop used in many our components, but it is supposed to be used as internal implementation only and must not be used as prop.The thing is that we have HoC
src/lib/components/withForwardedRef.jsx
that wraps original component withReact.forwardRef
. This redirectsref
toforwardedRef
, so every component wrapped by this HoC acceptsref
, notforwardedRef
.First problem is that API shows
forwardedRef
instead ofref
:Other problem is that code examples contain different kind of imports. Sometimes default export (the correct one) is used, sometimes named export is used (the wrong one). It results in fact that almost all examples contain
forwardedRef
, butref
must be used in implementation, otherwise it won't work.