-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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] Cannot read pxToRem
of undefined
#28496
Comments
Seems like some of your components are not wrapped within I am happy to help if you could provide code sample or the repo that I can take a look. |
pxToRem
of undefined
Components shouldn't need to be wrapped in a It doesn't look like this bug report has enough info for one of us to reproduce it. Please provide a CodeSandbox (https://material-ui.com/r/issue-template-latest), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve |
I have the same problem. |
Can you deal with a bitbucket git repo? I'll see if I can abstract something useful in the meantime. |
Thanks for the codesandbox. The correct way is to use `import { styled } from '@mui/material/styles', here is the working sandbox. May I ask where do you get the code sample from because it is from our documentation, we will need to fix it. |
Thank you for your quick answer. I referred to this page. link |
I think I've solved the issue. The main issue seems to be a simple error on my part. It appears to me that there is also an issue in the v4-to-v5 migration page (https://next.material-ui.com/guides/migration-v4/). In my code, I missed the There are some other issues in the code sample that contributed to my confusion. Here is the code sample as presented in the documentation:
The first issue is that this code, as provided, fails to compile because The second issue is that, even with the new material installed, the I suggest at least commenting out the Here is the analogous code from my
I apologize for the jerk-around -- I suspect that adding the |
Thanks for the input, I will open a fix for this. |
@eps1lon Ideally this wouldn't be needed but it changed in v5. Now, the If we see more complaints on this pain, maybe we could log a warning when developers use the (theme) => API with an empty theme? @mnajdova |
pxToRem
of undefinedpxToRem
of undefined
May I ask if this problem has been solved |
Based on the comments it seems like it has been solved. Please open a new issue with a reproduction if face similar problem. |
My attempt to migrate from v4 to v5 has broken my app. The stack trace of the multiple errors suggests that they originate from issues within the
@mui
components themselves. I have only limited ability to debug issues within thenode_modules
subdirectory tree.Current Behavior 😯
Here is a screenshot after following the upgrade recipe:
Expected Behavior 🤔
Here is a screenshot of the v4 behavior:
Steps to Reproduce 🕹
Steps:
Context 🔦
I've built an interactive data browser that currently uses up-to-date covid data. Other apps will follow.
I consciously use the Google Material UIX in order to optimize the user experience of my visitors, users, and clients.
Your Environment 🌎
`npx @mui/envinfo`
The above screenshots are from a Chrome browser running on Windows 10 Pro. The browser is running
Version 93.0.4577.82 (Official Build) (64-bit)
.The text was updated successfully, but these errors were encountered: