-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[migration] How can I replace makeStyles in my code? #32585
Comments
It is on the documentation:
Source: Migration from v4 to v5. If that doesn't solve try using one of this aproaches from Stack Overflow. |
You can still use JSS, you just need to update the imports to point directly to |
@mnajdova Which should be the right approach to migrate the theme engine? I have over a hundred components in my project and it seems
I'm not a fan of using And I would like to ask if using |
I suppose this can be used as a reference? #26571 But this leads to another question from me: I'm leaning toward |
@allicanseenow facing the same problem. Have you found a solution for this? |
In the end, I use tss-react. sx makes the jsx very disorganized and verbose, and it requires just way too many major changes for big projects. styled is even worse as it will create a lot of boilerplate components in your react tree. tss-react faces none of these issues |
I'm sorry, that's kind of a novice question.
I'm currently transferring from material-ui v4 to mui v5 and I used to have a lot of makeStyles and jss styling in the code.
I would like to ask what is the most appropriate way to replace makeStyles for creating classes based on theme variable values. I have code like this:
`
const useStyles = makeStyles((theme) => ({
box: {
marginTop: theme.spacing(0.5),
marginLeft: theme.spacing(-2.5),
},
table: {
maxHeight: '50vh',
overflow: 'auto',
maxWidth:
calc(100vw-${theme.spacing(5)})
,marginRight: theme.spacing(2.5),
},
tableCell: { padding:
${theme.spacing(0.5)} ${theme.spacing(1)}
},[
@media (max-width: ${mdWidth}px)
]: {tableCell: {
fontSize: '0.6em',
padding:
0px ${theme.spacing(1)}
,},
},
[
@media (min-width: ${mdWidth}px)
]: {box: {
marginTop: theme.spacing(0.5),
marginLeft: theme.spacing(0),
marginRight: theme.spacing(2.5),
},
},
}
)`
If possible, I would like to use a kind of jss solution and not pure css. I know about styled() approach, but wanted to ask if there are more appropriate ways of styling components with classes?
Thanks in advance :)
The text was updated successfully, but these errors were encountered: