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

[docs] Remove unecessary createStyles in TypeScript Tabs demo #17164

Merged
merged 1 commit into from
Aug 26, 2019

Conversation

imballinst
Copy link
Contributor

@imballinst imballinst commented Aug 26, 2019

This PR changes files in Tabs demo that uses createStyles when the Hook API makeStyles is already used. When using TypeScript, makeStyles alone is enough -- createStyles is used only if the HOC API withStyles is used -- because there are some type incompatibilities with some styles e.g. flexboxes (flexDirection, flexGrow, etc.).

Some parts of the demo I left them as they were -- because I think HOC is more appropriate in these cases instead of Hooks, e.g.

https://github.com/mui-org/material-ui/blob/44c335c3b3f8669b16901c5f777bb5ba9e9241c0/docs/src/pages/components/tabs/CustomizedTabs.tsx#L16-L49

This is because withStyles generates classes prop directly -- and almost all Material UI components can consume classes prop from its parent. As they are more like "reusable sub-components", inlining withStyles with the components is better in my opinion.

@mui-pr-bot
Copy link

No bundle size changes comparing 44c335c...cfcd311

Generated by 🚫 dangerJS against cfcd311

@eps1lon eps1lon added docs Improvements or additions to the documentation typescript labels Aug 26, 2019
@eps1lon eps1lon changed the title [docs] remove createStyles in TypeScript Tabs demo when used with makeStyles [docs] Remove unecessary createStyles in TypeScript Tabs demo Aug 26, 2019
@eps1lon eps1lon merged commit a359cc1 into mui:master Aug 26, 2019
@eps1lon
Copy link
Member

eps1lon commented Aug 26, 2019

@imballinst Much appreciated. Thanks.

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 typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants