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

[several components] replace "withStyles" with "useStyles" in internal component implementations #17654

Closed
1 task done
croraf opened this issue Oct 1, 2019 · 1 comment
Closed
1 task done
Labels
duplicate This issue or pull request already exists package: system Specific to @mui/system

Comments

@croraf
Copy link
Contributor

croraf commented Oct 1, 2019

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

Summary 💡

One of the main reasons React introduced hooks was to remove the long component tree chains in react-devtools, arising when HOCs are used.

MUI uses withStyles internally which gives rise to much longer component tree chains in react-devtools. I suggest to switch to the equivalent useStyles syntax in internal implementations.

Check: https://codesandbox.io/s/hoc-hook-comparisson-mui-h6oq9

image

Specific example of Button MUI component has:
image
Instead of much simpler:
image

@croraf croraf changed the title [several components] replace withStyles HOC to useStyles in internal component implementation [several components] replace "withStyles" with "useStyles" in internal component implementations Oct 1, 2019
@oliviertassinari
Copy link
Member

Related to #15023. The effort was paused for #6115.

@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 20, 2022
@zannager zannager added the package: system Specific to @mui/system label Dec 20, 2022
@zannager zannager added duplicate This issue or pull request already exists and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists package: system Specific to @mui/system
Projects
None yet
Development

No branches or pull requests

3 participants