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

[styles] Add React 18 to peer dep #40492

Closed
wants to merge 1 commit into from
Closed

Conversation

brijeshb42
Copy link
Contributor

Fixes #40477

@brijeshb42 brijeshb42 added the package: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5. label Jan 9, 2024
@brijeshb42 brijeshb42 requested review from michaldudak and a team January 9, 2024 08:54
@mui-bot
Copy link

mui-bot commented Jan 9, 2024

Netlify deploy preview

https://deploy-preview-40492--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against f743e4f

@michaldudak
Copy link
Member

@mui/styles is not compatible with React 18.

@brijeshb42 brijeshb42 closed this Jan 9, 2024
@jinsley8
Copy link

jinsley8 commented Jan 9, 2024

@mui/styles is not compatible with React 18.

The docs have some conflicting information about styles. Is @mui/material/styles preferred over @mui/styles now in v5?

https://mui.com/material-ui/migration/migration-v4/#material-ui-v5-and-mui-styles
https://mui.com/material-ui/migration/v5-style-changes/#%E2%9C%85-update-createstyles-import

@samuelsycamore
Copy link
Contributor

@mui/styles is not compatible with React 18.

The docs have some conflicting information about styles. Is @mui/material/styles preferred over @mui/styles now in v5?

https://mui.com/material-ui/migration/migration-v4/#material-ui-v5-and-mui-styles https://mui.com/material-ui/migration/v5-style-changes/#%E2%9C%85-update-createstyles-import

I can see why these sections could cause confusion out of context, but the migration docs are explaining how to progressively migrate to v5 without migrating away from @mui/styles immediately, which is something that you should do eventually, as the doc states:

Note that you may continue to use JSS for adding overrides to the components (e.g. makeStyles, withStyles) even after migrating to v5. Once you've completed the rest of the v5 upgrade, we recommend progressively moving over to the new styling engine.

This process is covered in Migrating from JSS.

So it's showing you how to continue to use the (deprecated) @mui/styles package with v5 while you're still in the process of migrating. Does that make sense?

@mui/styles was deprecated with the release of v5 in 2021, so it does not and will not support React 18+. You should always use @mui/material/styles instead, which is the package of Emotion-based tools that replaced the earlier JSS versions.

@jinsley8
Copy link

jinsley8 commented Jan 9, 2024

@samuelsycamore Thanks for clarifying.

Turns out I had @mui/styles installed but I'm not using it in any files. Everything was already updated to @/mui/material/styles. I've since deleted @mui/styles.

@oliviertassinari oliviertassinari added the status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5. status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[system] 5.15.3 peer dependency react@"^17.0.0" not found when using [email protected]
6 participants