Closed essuraj closed 3 years ago
This may be relevant too https://github.com/mui-org/material-ui/issues/20012
@essuraj if you could wait until this PR #27032 is merged. It could help reduce your migration work.
no clarity on any migration strategy
Should we add these modules back in v5, with an explicit error for those that try to call them?
import MuiError from '@material-ui/utils/macros/MuiError.macro';
throw new MuiError([
'Material-UI: x is not longer exported from @material-ui/core.',
'You have to import it from @material-ui/styles.',
'See https://material-ui.com/r/migration-v4/#material-ui-core-styles for more details.',
].join('\n'));
This will help the busy developers that don't have the time to read in detail the migration guide. With the link, they would find the codemod.
I'm having to install '@material-ui/styles'; but again i get errors, Property 'spacing' does not exist on type 'DefaultTheme'. @mnajdova @oliviertassinari @siriwatknp
Should we add these modules back in v5, with an explicit error for those that try to call them?
Letβs do it!
Consulting the docs, I am unable to import makeStyles (per docs) on v5.0.0-beta 0 | '@material-ui/styles'
How should I be importing makeStyles
now?
@jrhager84. Did you install @material-ui/styles@v5.0.0
?
@jrhager84. Did you install
@material-ui/styles@v5.0.0
?
I did eventually, but the documentation is extremely nebulous about the requirements. I'm trying to find where it said, but it basically said it was broken out of /core, and unless you plan on using the themes outsides of Mui, to install the /styles package. I'll try to dig up where I saw it. I can't immediately find it presently.
@jrhager84. Did you install
@material-ui/styles@v5.0.0
?I did eventually, but the documentation is extremely nebulous about the requirements. I'm trying to find where it said, but it basically said it was broken out of /core, and unless you plan on using the themes outsides of Mui, to install the /styles package. I'll try to dig up where I saw it. I can't immediately find it presently.
It is here were the warning specifies to install @material-ui/styles
which causes issues with makeStyles
since the theme is not within the same context and the theme argument comes back as an empty object.
const useStyles = makeStyles(theme => {
console.log(theme) // {}
return {...}
})
Installing @material-ui/styles@v5.0.0 solved the issue for me.
Installing @material-ui/styles@v5.0.0 solved the issue for me.
Thank god I found this. I didn't realize there was a new version of @material-ui/styles for v5.0.0. Maybe you should make this more clear in the migration guide?
@mnajdova Maybe we shouldn't wait for a community member to take on this issue and implement https://github.com/mui-org/material-ui/issues/27216#issuecomment-877643063 now?
Lost on an hour on this one π
Suggested documentation improvements related to the issue, on page https://next.material-ui.com/styles/basics/#installation
While under the next
subdomain, this should suggest installing @material-ui/styles@next
, if you just install @material-ui/styles
you'll pick up v4, which will silently break theming (empty theme obj, etc.).
It says under a yellow sticky:
@material-ui/styles is re-exported as @material-ui/core/styles - you only need to install it if you wish to use it independently from Material-UI.
This is not true. If you are making use of makeStyles
you must install @material-ui/styles
.
This one more of an opinion, but I believe ThemeProvider
is now always required? If so, I believe this section should move up: https://next.material-ui.com/styles/basics/#using-the-theme-context.
@mnajdova Maybe we shouldn't wait for a community member to take on this issue and implement #27216 (comment) now?
will do it on Monday π
@jtgi Thanks for the extra feedback. It does seem that we have more improvements opportunities, π for these 3 points.
Lost on an hour on this one π
Suggested documentation improvements related to the issue, on page https://next.material-ui.com/styles/basics/#installation
- While under the
next
subdomain, this should suggest installing@material-ui/styles@next
, if you just install@material-ui/styles
you'll pick up v4, which will silently break theming (empty theme obj, etc.).- It says under a yellow sticky:
@material-ui/styles is re-exported as @material-ui/core/styles - you only need to install it if you wish to use it independently from Material-UI.
This is not true. If you are making use ofmakeStyles
you must install@material-ui/styles
.- This one more of an opinion, but I believe
ThemeProvider
is now always required? If so, I believe this section should move up: https://next.material-ui.com/styles/basics/#using-the-theme-context.
This is the place I was referring to. It made it seem as though if you were using MUI, you wouldn't have to install the styles module, as you'd only have to do that if you were only using the styling.
Using 5.0.0-beta.2
and I still have access to makeStyles
. The legacy styling code will be completely removed by the time the stable version is released, correct?
makeStyles not found since v5.0.0-alpha.35 and no clarity on any migration strategy, the whole code base is filled with makeStyles and unsure of how to migrate them to beta, any pointers?