-
Notifications
You must be signed in to change notification settings - Fork 67
Receiving/passing ref #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Moreover, if I have hundred components with themr and redux, I need to write everywhere the same thing
That adds absolutely redundant data transformation on each render just to get underlying ref. |
@klimashkin Unfortunately I don't have enough practice with innerRef/withRef because, well, I just don't use it. But anyway, why can't we just pass actual ref prop through all the hocs? Does React somehow violate accessing it? On the other hand, when you assume that underline instance has a Still after looking into the source there's a prop |
Because of React design - child component never receive it, react uses it to pass component instance of child element up to parent.
And with
Read about |
@klimashkin I see. Do you suggest reverting replacement of |
That's why I asked @javivelasco at #46 (comment) about introducing to react community new convention with two properties: I'm pretty happy with current |
I don't believe that introduction of a new convention looks like a solution but still I agree that innerRef could be reverted back to withRef at least to be similar to other existing hocs. |
The new ref forwarding api is coming to react https://github.com/bvaughn/rfcs/blob/ref-forwarding/text/0000-ref-forwarding.md |
Hi! To continue our conversation at #46
In 2.1.0 you added
mapThemrProps
with example:But
withRef
is usually boolean, for example in react-redux, so it doesn't work.It was case, when
@themr
hoc wraps another hoc. But what if vice-versa, I have places where it's wrapped by@connect
.It used to be simple convention: In hoc's ref handler function it checked if underline instance also has getWrappedInstance and used it to take ref from it, so it's a chain when you can reach real component no matter how many hocs do you have on top of it
But now having somewhere
withRef
, somewhereinnerRef
ormapThemrProps
I'm confused.Feels like it has added complexity and problems instead of solving anything
The text was updated successfully, but these errors were encountered: