-
Notifications
You must be signed in to change notification settings - Fork 243
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
[MaterialUI] Cannot read properties of null (reading 'useContext') #596
Comments
Try adding to package.json following: Replace react version with yours |
Hello nahimr, were you able to resolve this error? |
I can fix this issue by adding these two dependencies in host and remote app-
Incase using ThemeProvider then wrap host app with ThemeProvider as well |
I dont like it, but in a setup where both host and remote are Vite projects then adding "@emotion/styled" and "@mui/material" as shared in both host and remote fixed the problem for me:
When host is Webpack and remote is Vite, removing the node_modules + package-lock, and changing the @mui/material version to be strictly 5.15.4 did the job. i.e., in package.json, update the dependency to this: "@mui/material": "5.15.4", |
When calling
useTheme
hook from @mui/material, this throws an error.Shared dependencies
On host side :
On remote side :
Versions
Steps to reproduce
What is Expected?
It's expected to use correctly the hook
useContext
that its called byuseTheme
.What is actually happening?
It's missing shared
useContext
reference of React.Related to #595.
The text was updated successfully, but these errors were encountered: