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

Provide better documentation for withTheme #12419

Closed
2 tasks done
enricopolanski opened this issue Aug 5, 2018 · 3 comments
Closed
2 tasks done

Provide better documentation for withTheme #12419

enricopolanski opened this issue Aug 5, 2018 · 3 comments
Assignees
Labels
docs Improvements or additions to the documentation new feature New feature or request

Comments

@enricopolanski
Copy link

I feel like the documentation for withTheme is pretty dry and would benefit from having a better description for what the feature does, what problems does it solve and would benefit from having an example code.

  • This is a v1.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.
@oliviertassinari oliviertassinari added docs Improvements or additions to the documentation new feature New feature or request labels Aug 6, 2018
@oliviertassinari
Copy link
Member

@VulcanRav What extra information would you like to know?
https://material-ui.com/customization/themes/#withtheme-component-component

@enricopolanski
Copy link
Author

I sincerely do not understand what's the purpose of this method or when/how to use it.

I'd guess it's used to access the theme variable in a component I wrap with this HOC, but so far I've been unable to access it as a prop (which is the point of making an example in the docs) and looking at the code and tests I'm still confused. It seems like the theme is now in the HOC's state, but I'm still not sure how to use it (I guess with state.theme). But is the theme here passed from a parent MuiThemeProvider such as in style functions when passing the theme as a prop?

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 6, 2018

@VulcanRav Alright, we need a more detailed example. This HOC injects the theme property into the component so it can be used in the render method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation new feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants