Getting at the wrapped React component when exporting withStyles
See original GitHub issueIs it possible to get at the React class wrapped by WithStyles?
Context: getting the ref to a child component e.g.
<MyComponent ref="myComponent"></MyComponent>
Trying to reference this.refs.myComponent
gives me a WithStyles
object obviously and not a MyComponent
object.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:17 (12 by maintainers)
Top Results From Across the Web
Getting at the wrapped React component when exporting ...
Is it possible to get at the React class wrapped by WithStyles? Context: getting the ref to a child component e.g. Trying to...
Read more >withStyles component wrap - reactjs - Stack Overflow
The problem is because the withStyles HOC return a new component so you are getting the reference of the HOC. You can use...
Read more >Reactjs – How to shallow test a react component wrapped in memo ...
The only option I am currently aware of is to independently export Demo and export default withStyles(styles)(Demo) . This allows me to test...
Read more >How To Use React Styled Components Efficiently - Copycat
Learn how to set up organized React styled components in your project through examples, comprehensive explanations, and tips and tricks!
Read more >How to Wrap One React Component into Another | Pluralsight
It's quite easy to apply a HOC to any component; we just need to import the required HOC function and wrap our original...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@snydersaurus
withStyles
enhance the components with aninnerRef
property. You can use it.Edit for v4: this workaround is no longer needed. You can simply provide a
ref
now.@mbrucher can you create a new issue with a reproduction please 😃