Skip to content
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

[withWidth] Add innerRef property #12216

Closed
2 tasks done
itelo opened this issue Jul 20, 2018 · 6 comments
Closed
2 tasks done

[withWidth] Add innerRef property #12216

itelo opened this issue Jul 20, 2018 · 6 comments
Labels
good first issue Great for first contributions. Enable to learn the contribution process. new feature New feature or request

Comments

@itelo
Copy link
Contributor

itelo commented Jul 20, 2018

  • This is a v1.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

I expected to use like withStyles, that I access with innerRef.

Current Behavior

I can't access the ref of my component.

Examples

export default withWidth()(MyComponent)

Context

I want to access refs using innerRef or something like that when using HOC withWidth

@oliviertassinari
Copy link
Member

@itelo You can use the RootRef component for this use case. Regarding the innerRef property. My hope is that it can be legacy with #10825.

@oliviertassinari oliviertassinari added the good first issue Great for first contributions. Enable to learn the contribution process. label Jul 20, 2018
@oliviertassinari oliviertassinari changed the title cannot access ref when using withWidth [withWidth] Add innerRef property Jul 20, 2018
@oliviertassinari
Copy link
Member

The withTheme higher-order component could take advantage of it too.

@oliviertassinari oliviertassinari added the new feature New feature or request label Jul 20, 2018
@itelo
Copy link
Contributor Author

itelo commented Jul 21, 2018

@oliviertassinari can you give an example of how to use the RootRef? I want to access the props and state. With RootRef I only get access to the DOM.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jul 21, 2018

I want to access the props and state.

@itelo No, you can't access the state with RootRef, you will only be able to do it with forwardRef (#10825).
Anyway, I think that we should be consistent, have withWidth, withTheme and withStyles support the same properties. I this something you want to work on? :)

@itelo
Copy link
Contributor Author

itelo commented Jul 22, 2018

Certainly, tomorrow I will submit a PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Great for first contributions. Enable to learn the contribution process. new feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants