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

Remove @mui/styles according to migration from mui v4 to v5 #1826

Open
Fullbusters opened this issue Dec 3, 2021 · 6 comments
Open

Remove @mui/styles according to migration from mui v4 to v5 #1826

Fullbusters opened this issue Dec 3, 2021 · 6 comments

Comments

@Fullbusters
Copy link
Contributor

@mui/styles will be deprecated in mui v6 you can read about this here mui/material-ui#26571
And even in guide migration from v4 to v5 exist steps for removing @mui/styles from the project here: https://mui.com/guides/migration-v4/#migrate-from-jss
I was faced with an issue that mui-datatables still used @mui/styles and I can't remove it from the project.

Think that it's a bug, because:

  • it increases the size of bundle without any benefits,
  • using not last version of mui functional: mui 5 using emotion/styled/sx, but mui v4 using jss. That means now mui-datatables have two different ways for styles.

In my opinion, it`s should be migrated from @mui/styles as soon as possible.

Mui 5 provide for us two ways to remove it: https://mui.com/guides/migration-v4/#migrate-from-jss
But the most similar as makeStyles is this: https://dev.to/atonchev/material-ui-5-the-easiest-way-to-migrate-from-makestyles-to-emotion-1i9l

The fastest solution is to add @mui/styles to peerDependency #1820 that allow for devs to remove @mui/styles from their projects, and then step by step doing a migration from @mui/styles to emotion.

Tech Version
Material-UI 5.2.1
MUI-datatables 4.0.0
React 17.0.2
@maganezf
Copy link

maganezf commented Dec 7, 2021

Up

@Fullbusters
Copy link
Contributor Author

@zxhmike @wdh2100 @ashfaqnisar can you take a look to this

@ashfaqnisar
Copy link
Contributor

ashfaqnisar commented Dec 17, 2021

Hey @Fullbusters, I tried the codemod provided by mui and was able to switch most of the jss styles to styled components but it was not able to do the conversion for some of the files.
I also looked at tss-react, it seems like a great and easy to switch option, what do you think ?

@Fullbusters
Copy link
Contributor Author

Fullbusters commented Dec 20, 2021

hey @ashfaqnisar, codemod not switching all things that needed, and they not remove @mui/styles at all, so it's should will be done by devs by themself.
yes tss-react it's good alternative, and it's recommended by mui in their guide for migrate https://mui.com/guides/migration-v4/#2-use-tss-react
thanks

@liamlows
Copy link

@Fullbusters Do we know if the conversion away from utilizing @mui/stylesis happening/has happened? I would like to move away from the deprecated package before I move a project I am working on into production.

@Fullbusters
Copy link
Contributor Author

@liamlows until recently, I hoped that someone would do it, but I will have to (
I will try to do it this week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants